Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to post animated GIFs, documentation unclear #1655

Closed
jetley opened this issue Sep 17, 2021 · 1 comment
Closed

Unable to post animated GIFs, documentation unclear #1655

jetley opened this issue Sep 17, 2021 · 1 comment
Labels
Duplicate This is a duplicate Question This is a question Stale This is inactive, outdated, too old, or no longer applicable

Comments

@jetley
Copy link

jetley commented Sep 17, 2021

I'm trying to post an animated gif (less than 15MB) but nothing happens.

Here's my minimal working example:

import tweepy
import os

consumer_key = ''
consumer_secret = ''
key = ''
secret = ''

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(key, secret)

api = tweepy.API(auth, wait_on_rate_limit=True)

api.media_upload("./gif/GIF_CAPTION_OPTIMIZED.gif")

Nothing is uploaded and the following error is shown in console:

Traceback (most recent call last):
  File "e:\PAU\bot\000 MAIN\testuploadgif.py", line 14, in <module>
    api.media_upload("./gif/GIF_CAPTION_OPTIMIZED.gif")
  File "C:\Users\34684\AppData\Local\Programs\Python\Python39\lib\site-packages\tweepy\api.py", line 243, in media_upload
    return bind_api(
  File "C:\Users\34684\AppData\Local\Programs\Python\Python39\lib\site-packages\tweepy\binder.py", line 253, in _call
    return method.execute()
  File "C:\Users\34684\AppData\Local\Programs\Python\Python39\lib\site-packages\tweepy\binder.py", line 234, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: Twitter error response: status code = 413

I'm not using api.update_with_media() as it is deprecated.

Is this a bug or am I simply doing it wrong? I cannot find further information in the documentation or examples that help me with this.

@Harmon758
Copy link
Member

The 413 (Payload Too Large) [HTTP response] status code indicates that the server is refusing to process a request because the request payload is larger than the server is willing or able to process.

https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.11

It seems like you're using a version of Tweepy that doesn't support chunked uploading of media.
This is likely a duplicate of #1501 that should be resolved with #1486 in the latest development version on the master branch, set to be released as part of v4.0.

Feel free to submit a new issue if you can reproduce this with the latest development version.

@Harmon758 Harmon758 added Duplicate This is a duplicate Stale This is inactive, outdated, too old, or no longer applicable Question This is a question labels Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate This is a duplicate Question This is a question Stale This is inactive, outdated, too old, or no longer applicable
Projects
None yet
Development

No branches or pull requests

2 participants