In python3 a bytes object needs to be decoded after image upload
This commit is contained in:
@@ -323,6 +323,8 @@ class Client(object):
|
|||||||
:param image: a tuple of (file name, data, mime type) to upload to facebook
|
:param image: a tuple of (file name, data, mime type) to upload to facebook
|
||||||
"""
|
"""
|
||||||
r = self._postFile(UploadURL, image)
|
r = self._postFile(UploadURL, image)
|
||||||
|
if isinstance(r._content, str) is False:
|
||||||
|
r._content = r._content.decode("utf-8")
|
||||||
# Strip the start and parse out the returned image_id
|
# Strip the start and parse out the returned image_id
|
||||||
return json.loads(r._content[9:])['payload']['metadata'][0]['image_id']
|
return json.loads(r._content[9:])['payload']['metadata'][0]['image_id']
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user