I've read the docs and try to make a function to upload image on facebook and get its api but it seems not work at all. (the access token have permisson to do that request so ye)

def upload_image(token, gid, image_path):         res = requests.post(f"https://graph.facebook.com/{gid}/photos", params={"access_token": token}, files={"source": open(image_path, "rb")})         print(res.text)         return res.json().get("id") 

The weird part is I kept getting the error #324 (Requires upload file).

Tag:python, python-3.x, facebook, facebook-graph-api

Add a new comment.