Guys,
still a beginner at Python, so please be patient.
I'm using the twitter.request function for a Twitter API request.
The result is a tuple consisting of a return code and the actual JSON result.
I want to get hold of that JSON result like this:
if status == 200:
result = json.loads(data)
However, I get this error:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/9D2704E0-434A-4879-8FB0-30594FA3A28D/Pythonista3/Documents/addToCollectionIK.py", line 17, in
result = json.loads(data)
File "/var/containers/Bundle/Application/B09EF8B7-CE0F-4572-9748-EC15615DEA7A/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'
Why is that and what can I do about it? From what I understand the twitter.request function doesn't seem to return the JSON object as a string but as 'bytes' (what's that?). So I need to make a string out of that bytes, right? But how?
(btw, the json.load(data) function doesn't work, either ...)
Thanks a lot,
Stefan.