ping / instagram_private_api

A Python library to access Instagram's private API.
MIT License
2.95k stars 612 forks source link

Added upload_image functionality #307

Open kn0wm4d opened 3 years ago

kn0wm4d commented 3 years ago

What does this PR do?

Added upload_image functionality for both posts and stories

from PIL import Image
from instagram_private_api import Client

api = Client(username=...,password=...)

with Image.open('/Users/kn0wm4d/Desktop/test.jpg') as img:
   photo_data = open('/Users/kn0wm4d/Desktop/test.jpg', 'rb')
   width, height = img.size
   size = (width, height)

api.upload_image(photo_data, quality=80, size=size, caption='Test', story=False)

Why was this PR needed?

Because IG deprecated post_photo (experimental endpoint).

What are the relevant issue numbers?

305

Does this PR meet the acceptance criteria?

MrTob commented 3 years ago

the upload_image functionality returns a 500 HTTP Error

urllib.error.HTTPError: HTTP Error 500: Internal Server Error