I'm trying to strip the characters b,'()
.
The issue I'm having is that it says TypeError 'str' does not support the buffer interface.
Here are the relevant parts of code in this:
import urllib3
def command_uptime():
http = urllib3.PoolManager()
r = http.request('GET', 'https://nightdev.com/hosted/uptime.php?channel=TrippedNW')
rawData = r.data
liveTime = bytes(rawData.strip("b,\'()", rawData))
message = "Tripped has been live for: ", liveTime
send_message(CHAN, message)
What you have is binary data. Its not a string. You need to decode it first.
Also you don't need to pass rawData
to itself in strip method.
import urllib3
def command_uptime():
http = urllib3.PoolManager()
r = http.request('GET', 'https://nightdev.com/hosted/uptime.php?channel=TrippedNW')
strData = r.data.decode('utf-8')
liveTime = strData.strip("b,\'()")
message = "Tripped has been live for: %s" % liveTime
print(message)
command_uptime()
Be also aware that your message
variable is a tuple not a string. I dont know if send_message
expects this. I formatted it into a single string.