Questions tagged [tweepy]

Tweepy is an easy-to-use Python library for accessing the Twitter API. It can be used with Python (3.7+).

Tweepy is an open source Python library for accessing the Twitter API.

The source code and documentation are available on GitHub. The library also has a community Discord server.

3361 questions
16
votes
1 answer

When using tweepy cursor, what is the best practice for catching over capacity errors?

I'm gathering information on a large number of users using Python's Tweepy library. I've the API initialized as follows api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True) where auth contains my tokens. This code…
user1507889
  • 463
  • 8
  • 19
14
votes
1 answer

How to stream twitter mentions with tweepy?

I am currently using the following code, this gets the tweet and then passes it to a function that processes. This is not in realtime though. auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token,…
Bossman759
  • 165
  • 2
  • 7
13
votes
5 answers

return actual tweets in tweepy?

I was writing a twitter program using tweepy. When I run this code, it prints the Python ... values for them, like Which is not good. How do I get the actual tweet? import tweepy, tweepy.api key =…
tekknolagi
  • 10,663
  • 24
  • 75
  • 119
13
votes
4 answers

Tweepy Truncated Status

I was mining user timeline data with tweepy and, have faced some difficulties in understanding the following: Is the 'retweeted' and 'truncated' attribute referring to the same thing (i.e., status text beyond 140 characters)? If not, what is the…
Abrar Hossain
  • 2,594
  • 8
  • 29
  • 54
13
votes
1 answer

Logical Operators in Tweepy Filter

I'm hoping to track tweets that contain a certain set of words, but not others. For example, if my filter is: "taco" AND ("chicken" OR "beef"). It should return these tweets: -I am eating a chicken taco. -I am eating a beef taco. It should not…
Sam Zipper
  • 642
  • 1
  • 7
  • 19
12
votes
1 answer

Scrape tweets by tweet location and user location

I am trying to use tweepy to download tweets using the tweet location and not by user location. Currently, I can download tweets with the user location but am not able to get the tweet location even ifgeo_enabled returns True. For example, suppose…
Sitz Blogz
  • 1,061
  • 6
  • 30
  • 54
12
votes
3 answers

How to use Tweepy to retweet with a comment

So i am stuck trying to figure out how to retweet a tweet with a comment, this was added to twitter recently. this is when you click retweet and add a comment to the retweet and retweet it. basically this is what i am talking about : i was looking…
user4335407
  • 352
  • 1
  • 3
  • 11
12
votes
14 answers

Unable to import tweepy module

I am new to installing new python modules. I installed tweepy using pip install tweepy. The installation was successful and 2 folders tweepy & tweepy-3.3.0.dist-info are created in the Lib/site-packages, hence I assumed all should be fine. However,…
Jake
  • 2,482
  • 7
  • 27
  • 51
12
votes
3 answers

Streaming Twitter direct messages

I am using the following code to stream direct messages received by my Twitter account -: from tweepy import Stream from tweepy import OAuthHandler from tweepy import API from tweepy.streaming import StreamListener # These values are…
Anmol Singh Jaggi
  • 8,376
  • 4
  • 36
  • 77
12
votes
3 answers

tweepy documentation

I just began working on a little twitter-app using tweepy. is there any kind of useful (and complete) documentation for tweepy? I googled like hell but didn't find anything.
andy
  • 249
  • 3
  • 11
12
votes
1 answer

The best way to get a list of followers in Python with Tweepy

Is there a better way to get a list of followers screen names with Tweepy than this: for follower in api.followers_ids('twitter'): print api.get_user(follower).screen_name
user2547755
  • 229
  • 1
  • 5
  • 14
12
votes
2 answers

Getting a users entire twitter timeline with tweepy

I am trying to retrieve a list that contains the entire contents of my personal twitter statuses with python and tweepy. I have successfully authenticated via OAuth but cannot seem to recieve more than about 800 status updates from twitter. My…
Tim Bueno
  • 401
  • 2
  • 5
  • 11
11
votes
3 answers

Can't import StreamListener

I'm trying to create a data stream in Python using the Twitter API, but I'm unable to import the StreamListener correctly. Here's my code: import tweepy from tweepy import Stream from tweepy.streaming import StreamListener class…
Suvodeep Ghosh
  • 113
  • 1
  • 1
  • 6
11
votes
2 answers

Twitter Streaming API - urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead

Running a python script using tweepy which streams (using the twitter streaming API) in a random sample of english tweets, for a minute and then alternates to searching (using the twitter searching API) for a minute and then returns. Issue I've…
Chris Cookman
  • 246
  • 2
  • 8
11
votes
2 answers

Get all friends of a given user on twitter with tweepy

Using tweepy I am able to return all of my friends using a cursor. Is it possible to specify another user and get all of their friends? user = api.get_user('myTwitter') print "Retreiving friends for", user.screen_name for friend in…
user2497792
  • 505
  • 2
  • 9
  • 18