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
15
votes
5 answers

Using Twython to send a tweet, twitter api error

I'm trying to make python send a tweet for me using Twython but for some reason everything I'm trying isn't working. I've followed the Twython README but still unable to acheive what I want. Below is my latest attempted code: from twython import…
SMNALLY
  • 1,361
  • 3
  • 14
  • 23
9
votes
4 answers

Not able to get Country of a Tweet - Twython API

I am using the following code to collect Tweets pertaining to a certain topic but in all the tweets that I have extracted the 'places' attribute is None. Am I doing something wrong? Also, the code is meant to extract existing tweets and I do not…
silent_dev
  • 1,566
  • 3
  • 20
  • 45
9
votes
2 answers

Twitter Rest API: 404 No user matches for specified terms

Twitter allows up to 100 user ids at a time to query for user profile information. But if there is an invalid ID among those, it returns: 404 (Not Found), No user matches for specified terms without specifying which is the bad ID and no data is…
onurmatik
  • 5,105
  • 7
  • 42
  • 67
8
votes
0 answers

Twitter API - Retrieve all replies to a certain tweet

I am trying to use Twitter API with the Python wrapper Twython and I want to retrieve all replies (the comments below a tweet) to a certain tweet find using some patterns. At the moment to achieve this, I perform the search of a string, I retrieve…
Mark
  • 399
  • 4
  • 12
7
votes
3 answers

How to get twitter followers using Twython?

I want to get a list of twitter followers/following of a particular user, when their screenname or user.id is specified. Can anyone please give the code snippet for it? Thanks.
Nazim Zeeshan
  • 713
  • 1
  • 12
  • 20
7
votes
1 answer

Scrape User Location from Twitter

I am trying to scrape latitude and longitude of user from Twitter with respect to user names. The user name list is a csv file with more than 50 names in one input file. The below are two trials that I have made by far. Neither of them seems to be…
Sitz Blogz
  • 1,061
  • 6
  • 30
  • 54
6
votes
1 answer

Get count of reply to a particular tweets

I am using the Python tweepy library. I was successfully able to extract the 'liked' and 're-tweet' counts of a tweet using the below code: # Get count of handles who are following you def get_followers_count(handle): user =…
Prakash P
  • 3,582
  • 4
  • 38
  • 66
6
votes
1 answer

Fetching tweets with hashtag from Twitter using Python

How do we find or fetch tweets on the basis of hash tag. i.e. I want to find tweets regarding on a certain subject? Is it possible in Python using Twython? Thanks
Uselesssss
  • 2,127
  • 6
  • 28
  • 37
5
votes
1 answer

Twitter API: How to exclude retweets when searching tweets using Twython

I'm trying to exclude retweets and replies in my Twython search. Here is my code: from twython import Twython, TwythonError app_key = "xxxx" app_secret = "xxxx" oauth_token = "xxxx" oauth_token_secret = "xxxx" naughty_words = ["…
B. Chas
  • 51
  • 1
  • 6
5
votes
3 answers

Twitter API returned a 401 (Unauthorized), Invalid or expired token

I am using the below code to post a Tweet. This is a pretty standard authentication procedure but for some reason I cannot authenticate. The error I am getting is Twitter API returned a 401 (Unauthorized), Invalid or expired token. from twython…
Adriaan Joubert
  • 185
  • 1
  • 4
  • 15
5
votes
2 answers

How to post image to twitter with Twython?

I had this small script working perfectly for the last month from twython import Twython import glob import random app_key = "XXX" app_secret = "XXX" oauth_token = "XXX" oauth_token_secret = "XXX" twitter = Twython(app_key, app_secret, oauth_token,…
joaquinlpereyra
  • 956
  • 7
  • 17
5
votes
1 answer

Issue with fetching tweets from timeline as Twitter doesnt return 'next_results'

I am trying to fetch tweets from Twitter timeline using the max_id field present in next_results as demonstrated here.(Twython search API with next_results) For most of the queries I get the desired number(500+) of tweets but for some I get less…
kundan
  • 1,278
  • 14
  • 27
5
votes
4 answers

How do I return more than 100 Twitter search results with Twython?

Twitter only returns 100 tweets per "page" when returning search results on the API. They provide the max_id and since_id in the returned search_metadata that can be used as parameters to get earlier/later tweets. Twython 3.1.2 documentation…
Clay
  • 2,949
  • 3
  • 38
  • 54
5
votes
2 answers

Getting mentions and DMs through twitter stream API 1.1? (Using twython)

I'm using twython (twitter API library for python) to connect to the streaming API, but I seem to only get the public twitter stream possibly filtered by words. Isn't there a way to get a real-time stream of the authenticated user timeline or…
4
votes
1 answer

python-oauth2 with Twitter's oauth_callback

I'm using Twython as my Twitter API wrapper, and oauth2 to handle authentication. I'm trying to have a use login via twitter, and then redirecting him after the oauth dance to a dynamically generated oauth_callback. This, however, appears to be…
D-Nice
  • 4,772
  • 14
  • 52
  • 86
1
2 3
21 22