tweepy: Error when sending GIF with Tweepy

Hi,

I want to send a GIF with Tweepy but I’ve an error whereas with an JPG or PNG, it’s ok. Here is the simple script:

#!/usr/bin/python

import tweepy

CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

api = tweepy.API(auth)

api.update_with_media(filename="/root/image.gif")

The error encountered :

Traceback (most recent call last):
  File "./test.py", line 15, in <module>
    api.update_with_media(filename="/root/image.gif")
  File "/usr/local/lib/python2.7/dist-packages/tweepy/api.py", line 231, in update_with_media
    )(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 243, in _call
    return method.execute()
  File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 189, in execute
    raise TweepError('Failed to send request: %s' % e)
tweepy.error.TweepError: Failed to send request:

tweepy 3.4.0 python 2.7.9 debian 8.2

Any idea ? Thanks

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

@thomaslawn try:

pic = api.media_upload('PBR.gif')
api.update_status(status = 'test', media_ids = [pic.media_id_string] )

I think the media_ids kwarg expects a list (or other iterable).