You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anybody run into this one? Must be environmental but dependencies appear to be up to date. I am running 2.1.8:
$ python3
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> api_token = 'XXXX:YYYYYYYYYYYYYYYYYYYY'
>>> import pinboard
>>> pb = pinboard.Pinboard(api_token)
>>> print (pb)
<pinboard.pinboard.Pinboard object at 0x7f8a2330d198>
>>> pb.posts.update()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/pinboard/pinboard.py", line 196, in __call__
json_response = json.load(response)
File "/usr/lib/python3.5/json/__init__.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
>>>
Thanks!
The text was updated successfully, but these errors were encountered:
json.load() requires str, but HTTPResponse.read() returns bytes. In Python 3.6 it should work, as json.load() has additional logic to decode the bytes. https://docs.python.org/3/whatsnew/3.6.html#json.
In older versions, a patch is needed. Replace json.load(response) in pinboard/pinboard.py and bin/pinboard with
json.loads(response.read().decode('utf-8'))
or use parse_response=False and parse in your code:
Anybody run into this one? Must be environmental but dependencies appear to be up to date. I am running 2.1.8:
Thanks!
The text was updated successfully, but these errors were encountered: