nhfruchter / pgh-bustime

Real time bus location data for the Port Authority (Pittsburgh) bus system.
MIT License
18 stars 5 forks source link

Error in parseresponse #1

Closed bbrunaud closed 7 years ago

bbrunaud commented 7 years ago

Hello, thanks for the useful code to navigate the burgh!.

I tried the very first example and I got this output. '''

api = BustimeAPI(key) api.vehicles(rt=88) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/pghbustime/interface.py", line 179, in vehicles return self.response(url) File "/usr/local/lib/python3.5/dist-packages/pghbustime/interface.py", line 87, in response return self.parseresponse(resp)
File "/usr/local/lib/python3.5/dist-packages/pghbustime/interface.py", line 115, in parseresponse if self.RESPONSE_TOKEN not in resp: TypeError: a bytes-like object is required, not 'str' '''

thanks!

nhfruchter commented 7 years ago

This is a Python 3 issue. requests returns the content of a request in the bytes type, not the str type in Python 3. I added a small fix which runs resp.decode if the module is run on Py3.