Questions tagged [twython]

An actively maintained, pure Python wrapper for the Twitter API. Supports both the normal and streaming Twitter APIs.

Twython is a library providing an easy (and up-to-date) way to access Twitter data in Python. Actively maintained and featuring support for both Python 2.6+ and Python 3, it's been battle tested by companies, educational institutions and individuals alike.

Full repository on GitHub
Full documentation

Support for:

  • User information
  • Twitter lists
  • Timelines
  • Direct Messages
  • Image Uploading!
    • Updating user status with an image
    • Changing user avatar
    • Changing user background image
    • Changing user banner image
  • Support for Twitter's Streaming API
  • Seamless Python 3 support
317 questions
4
votes
2 answers

Twitter auth fails on Twython 2.3.4 with Error: 401, Failed to validate oauth signature and token

I just updated to Twython 2.3.4, but now my Twitter auth stops working. It fails on the ' auth_props = twitter.get_authentication_tokens()' line. Any idea what went wrong? Thanks in advance! The python code to do Twitter auth using Twython is…
Arman
  • 1,074
  • 3
  • 20
  • 40
4
votes
1 answer

Twython updateStatus - Unauthorized: Invalid / expired Token

I'm trying to post a tweet using Twython from Django-powered site. However, the 'twitter.updateStatus(status=tweet_text)' line results in the following error: TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. --…
Arman
  • 1,074
  • 3
  • 20
  • 40
3
votes
1 answer

Twython help: Is there a way to search for twitter users with a certain keyword in their bio?

I'm trying to identify interesting people to follow on Twitter. To do this, I want to find users who post a tweet containing various keywords and then filter out users whose bios don't contain certain keywords. I'm using the following code to…
Dloidean
  • 59
  • 7
3
votes
1 answer

Posting a random image from directory to twitter

So I'm working on a little mini project running off of a raspberry pi, of which the end goal is to have the pi running a python script to post a random image from a directory to twitter (a twitter bot). I have this code so far, and I'm getting an…
darkman9333
  • 131
  • 1
  • 2
  • 12
3
votes
1 answer

Twython 401 on stream, but REST works fine

NO KIDDING. My code was working yesterday So I'm writing a script to get streaming data using twython. But today it's giving me 401 errors. Even with the example code I tried new keys, and a new app, but it still gives me 401. However, normal REST…
KGo
  • 18,536
  • 11
  • 31
  • 47
3
votes
2 answers

how to get more than 100 tweets from the twitter search or streaming api using Twython

How can i use Twython to retrieve all tweets that mention for example "#Accounting" for say in New York? I used the Twitter search API but i was only allowed to get 100 tweets. I then tried to use the Twitter streaming filter API but wasn't able to…
jxn
  • 7,685
  • 28
  • 90
  • 172
3
votes
2 answers

How to avoid rate-limiting 429 error in Twython

I've created a function designed to run through a column of Twitter handles pandas dataframe, yet it always seems to hit rate-limiting error after just 14 calls. Here's the code. def poll_twitter(dfr): followers =…
elksie5000
  • 7,084
  • 12
  • 57
  • 87
3
votes
1 answer

Possible to tweet using appkey/secret key from a different account via twython?

I have a twitter account with an App made, currently it's setup so students can tweet from our website and as such their tweets show "via SchoolAppNameHere" at the bottom of their tweets. Is it possible to use Twython to use the Appkey and secret…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
3
votes
3 answers

Twitter API returned a 401 (Unauthorized), An error occurred processing your request

Here's my code for getting the followers and updating a status: from twython import Twython,TwythonError APP_KEY='mykey' APP_SECRET='mysecret' OAUTH_TOKEN='mytoken' OAUTH_TOKEN_SECRET='mytokensecret' twitter = Twython(APP_KEY, APP_SECRET,…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
3
votes
1 answer

Twython : Twitter API returned 500(Internal Server Error)

While trying to do a simple twitter search using Twython twitter = Twython('..', '..','..', '..') tweets = twitter.search(q="mangalore",count=100) I am getting this error: twython.exceptions.TwythonError: Twitter API returned a 500 (Internal Server…
Nazim Zeeshan
  • 713
  • 1
  • 12
  • 20
3
votes
1 answer

Twython OAuth1 issues, 401 error using example code

I'm trying to setup a stream using the latest version of Twython with Python 2.7.3. I'm trying to reproduce the example in the streaming docs which depend on the OAuth1 docs. Using the following code yields 401 errors until I kill execution: from…
Sevenless
  • 2,805
  • 4
  • 28
  • 47
3
votes
1 answer

Problems with GET trends/place (Twython)

Trying to access just the 'name' part of trends for Toronto. so far I have this but it is giving me errors: toronto = t.get_place_trends(id=4118) trend_array = [] for trend in toronto.trends.name: trend_array.append(trend) print…
applewood
  • 391
  • 2
  • 11
3
votes
5 answers

Twitter API/Twython - show user to get user profile image

How to get user profile image using Twython? I see show_user() method, but instantiating Twython with api key and secret + oauth token and secret, and calling this method returns 404: TwythonError: Twitter API returned a 404 (Not Found), Sorry, that…
Neara
  • 3,693
  • 7
  • 29
  • 40
3
votes
1 answer

JSON or SimpleJSON and Python with Twython

I'm a newbie to Python and JSON as well. I installed twython to "speak" to the Twitter API. I use Python 2.7 on a mac. I would like to get my mentions through the API. The program should identify the Twitter user who mentioned me. I try: t =…
hildwin
  • 95
  • 1
  • 1
  • 5
3
votes
1 answer

Twython - How to update status with media url

In my app, I let users to post to twitter. Now i would like to let them update their status with media. In twython.py i see a method update_status_with_media that reads the image from filesystem and uploads to twitter. My images are not in…
Neara
  • 3,693
  • 7
  • 29
  • 40
1
2
3
21 22