subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.19k stars 667 forks source link

Error 403 while uploading photo #745

Open samuelbraun04 opened 2 years ago

samuelbraun04 commented 2 years ago

Discussed in https://github.com/adw0rd/instagrapi/discussions/744

Originally posted by **diegogurr** June 23, 2022 After 1 week of posting photos (every 4 hours,using crontab) without problems now it says 'Photo Upload failed with the following response : My code for publishing: ``` def publishPost(path,description): try: cl.photo_upload(path,description) except LoginRequired: cl.relogin() cl.dump_settings(s_path) ``` What could be the problem? How can I solve this?

I'm getting the same error out of no where. My full traceback:

Traceback (most recent call last):
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://i.instagram.com/api/v1/media/configure_sidecar/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/samuelbraun04/instagramBot/sidecars.py", line 228, in sidecar
    bot.album_upload(files, str(open(CAPTIONS_PATH+CONJOINER+caption, "r", encoding='utf-8').read()))
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 217, in album_upload
    raise e
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 206, in album_upload
    configured = (configure_handler or self.album_configure)(
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 285, in album_configure
    return self.private_request(
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 445, in private_request
    raise e
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 432, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 323, in _send_private_request
    raise LoginRequired(response=e.response, **last_json)
instagrapi.exceptions.LoginRequired: login_required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/samuelbraun04/instagramBot/sidecars.py", line 230, in sidecar
    bot.photo_upload(files[0], str(open(CAPTIONS_PATH+CONJOINER+caption, "r", encoding='utf-8').read()))
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/photo.py", line 230, in photo_upload
    upload_id, width, height = self.photo_rupload(path, upload_id)
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/photo.py", line 192, in photo_rupload
    raise PhotoNotUpload(response.text, response=response, **last_json)
instagrapi.exceptions.PhotoNotUpload: login_required
ghost commented 2 years ago

Discussed in #744

Originally posted by diegogurr June 23, 2022 After 1 week of posting photos (every 4 hours,using crontab) without problems now it says 'Photo Upload failed with the following response : <Response [403]> My code for publishing:

def publishPost(path,description):
    try:
        cl.photo_upload(path,description)
    except LoginRequired:
        cl.relogin()
        cl.dump_settings(s_path)

What could be the problem? How can I solve this?

I'm getting the same error out of no where. My full traceback:

Traceback (most recent call last):
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://i.instagram.com/api/v1/media/configure_sidecar/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/samuelbraun04/instagramBot/sidecars.py", line 228, in sidecar
    bot.album_upload(files, str(open(CAPTIONS_PATH+CONJOINER+caption, "r", encoding='utf-8').read()))
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 217, in album_upload
    raise e
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 206, in album_upload
    configured = (configure_handler or self.album_configure)(
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/album.py", line 285, in album_configure
    return self.private_request(
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 445, in private_request
    raise e
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 432, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 323, in _send_private_request
    raise LoginRequired(response=e.response, **last_json)
instagrapi.exceptions.LoginRequired: login_required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/samuelbraun04/instagramBot/sidecars.py", line 230, in sidecar
    bot.photo_upload(files[0], str(open(CAPTIONS_PATH+CONJOINER+caption, "r", encoding='utf-8').read()))
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/photo.py", line 230, in photo_upload
    upload_id, width, height = self.photo_rupload(path, upload_id)
  File "/home/samuelbraun04/.local/lib/python3.9/site-packages/instagrapi/mixins/photo.py", line 192, in photo_rupload
    raise PhotoNotUpload(response.text, response=response, **last_json)
instagrapi.exceptions.PhotoNotUpload: login_required

Did your account get temporarily or permanently terminated?