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

"IncompleteRead" Error when retrieving Twitter Data using Python

While running this program to retrieve Twitter data using Python 2.7.8 : #imports from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener #setting up the keys consumer_key = '…………...' consumer_secret =…
Hana
  • 157
  • 1
  • 2
  • 10
11
votes
4 answers

Post tweet with tweepy

I'm trying to post a tweet with the tweepy library. I use this code: import tweepy CONSUMER_KEY ="XXXX" CONSUMER_SECRET = "XXXX" ACCESS_KEY = "XXXX" ACCESS_SECRET = "XXXX" auth = tweepy.OAuthHandler(CONSUMER_KEY,…
Riccardo Gai
  • 421
  • 1
  • 6
  • 19
11
votes
2 answers

How can I retrieve all Tweets and attributes for a given user using Python?

I am attempting to retrieve data from Twitter, using Tweepy for a username typed at the command line. I'm wanting to extract quite a bit of data about the status and user,so have come up with the following: Note that I am importing all the required…
chowden
  • 305
  • 1
  • 3
  • 10
11
votes
2 answers

How do I print out the full url with tweepy?

How do I print out the full urls in tweepy (rather than the t.co link)? The following code prints out "this is a test link http://t.co/93Hme7Jv 90210", even though twitter.com shows "this is a test link http://www.test.com/test 90210". import…
user_78361084
  • 3,538
  • 22
  • 85
  • 147
10
votes
2 answers

Twitter API.get_user() TypeError: takes 1 positional argument but 2 were given ​

I'm still really new to coding and currently taking courses online, in which we are beginning to work with the Twitter API. I am trying to capture the ID of a Twitter account and display it below, but I keep getting this TypeError and can't figure…
chrisscartier
  • 101
  • 1
  • 1
  • 5
10
votes
1 answer

Sending multiple medias with tweepy

I am trying to make a Twitter bot with tweepy. It's actually my first twitter BOT, I'm kinda new to it. I have a list of medias containing the path of each image I need to send. I am able to send tweets with text api.update_status(status="some…
Keelah
  • 192
  • 3
  • 15
10
votes
1 answer

Invalid argument error from background process when main script stops

I have this code to get tweets by running a background process. The following script is run from main script using subprocess.Popen function. So that the main script will stop executing after invoking the background process script. def…
Marlon Abeykoon
  • 11,927
  • 4
  • 54
  • 75
10
votes
2 answers

What is the difference between on_data and on_status in the tweepy library?

I just started using tweepy library to connect with streaming api of twitter. I encountered both on_status() and on_data() methods of the StreamListener class. What is the difference? Total noob here!
sidx
  • 640
  • 2
  • 11
  • 28
10
votes
1 answer

Tweepy streaming API: filtering on user

I'm trying to simply connect to the Twitter streaming API using tweepy (and python 3), and stream all tweets from a given single user. I was under the impression this is possible, so I have the following simple code to do this: from tweepy import…
gogurt
  • 811
  • 1
  • 8
  • 24
10
votes
1 answer

Traceback when updating status on twitter via Tweepy

I've been trying to post the readings from my Rpi on Twitter using tweepy, but first I wanted to check if tweepy was working properly, but it's not. I installed the packages properly, but when I'm trying to run a simple code to post something, I got…
Thonka
  • 113
  • 1
  • 2
  • 8
10
votes
2 answers

Using regular expression in Twitter API

I am using Tweepy Library in Python to search for tweets. I am wondering, if I can use regular expression to search Tweets. I am using the following code : query = 'ARNOLD or SYLVESTER' for tweet in tweepy.Cursor(api.search, …
Kiran
  • 8,034
  • 36
  • 110
  • 176
9
votes
2 answers

How to post a tweet with media (picture) using Twitter API V2 and Tweepy Python?

i'm trying to create my first Twitter bot using Twitter API V.2 and Tweepy. So i can post simple text Tweets but i haven't found how to post tweets with medias (pictures) so how can i do that ? (I saw that some people say "you can't post media…
Gianni Huynh
  • 91
  • 1
  • 2
9
votes
4 answers

Python os.getenv() returning None when set Windows environment variables

I am following a Twitter bot tutorial using the Twippy library and Twitter API: https://realpython.com/twitter-bot-python-tweepy/ I set the config.py file and set my Windows environment variables as user variables with all my tokens. But when I run…
9
votes
2 answers

tweepy: truncated tweets when using tweet_mode='extended'

This is my code in python import tweepy import csv consumer_key = "?" consumer_secret = "?" access_token = "?" access_token_secret = "?" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token,…
apt45
  • 412
  • 1
  • 6
  • 14
9
votes
1 answer

Tweepy.cursor multiple / OR logic function for query terms

I'm trying to search twitter for a finite period of time in the past couple days to pull 2-3 keywords, but I can't seem to figure out how to search multiple terms at once. There are probably other ways to do this, but I've got a short code using…
Kees
  • 451
  • 1
  • 8
  • 17