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
9
votes
1 answer

TypeError: file() takes at most 3 arguments (4 given)

I am using Spyder on a Mac and the Python version on Spyder is 2.7. I had been using the following code a few months ago to scrape tweets, but now I find that it no longer works. First, I could no longer use: from urllib.request import url…
bayrah
  • 189
  • 1
  • 3
  • 12
9
votes
2 answers

How to get media_url from tweets using the Tweepy API

I am using this code: import tweepy from tweepy.api import API import urllib import os i = 1 consumer_key="xx" consumer_secret="xx" access_token="xx" access_token_secret="xx" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.secure =…
MarcCharbo
  • 207
  • 2
  • 3
  • 9
9
votes
4 answers

Unable to stop Streaming in tweepy after one minute

I am trying to stream twitter data for a period of time of say 5 minutes, using the Stream.filter() method. I am storing the retrieved tweets in a JSON file. The problem is I am unable to stop the filter() method from within the program. I need to…
Abin
  • 113
  • 1
  • 1
  • 8
9
votes
1 answer

How to get tweets of a particular hashtag in a location in a tweepy?

I wish to obtain tweets of a particular hashtag from a a particular location say Chennai for analysing data. I'm really new to Twitter API and tweepy. I found that the search url would look like this : …
anirudh_raja
  • 369
  • 2
  • 9
  • 20
9
votes
1 answer

401 error while using tweepy

I am running the below program.But am getting the below error Message. 401 **** 401 **** (keeps on repeating) The code(got from some forum) basically tries to connect to Twitter and fetch tweets. When its ran on ubuntu terminal the 401 error message…
subin alex
  • 149
  • 2
  • 9
9
votes
3 answers

Using tweepy to stream users' timeline and filtered tweets

I started exploring tweepy a couple days ago and was able to stream filtered (with keywords) tweets at real time. Now I want to stream not only filtered tweets but also tweets from several specific twitter users. Is this possible by using tweepy? It…
Blue482
  • 2,926
  • 5
  • 29
  • 40
9
votes
3 answers

Tweepy SSLError

I have a Django management command, launched via supervisord, that uses tweepy to consume the twitter streaming API. The agent works quite well however I notice in the logs there's an SSLError every 10-15 minutes and supervisord is re-launching the…
Dwight Gunning
  • 2,485
  • 25
  • 39
8
votes
1 answer

403 Forbidden 453 - You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints only

I had recently registered for the free level Twitter API, and I would like to use Tweepy to help me extract tweets from users. api_key = config['twitter']['api_key'] api_secret = config['twitter']['api_key_secret'] access_token =…
LaurenLai
  • 99
  • 1
  • 3
8
votes
1 answer

How to extract tweets location which contain specific keyword using twitter API in Python

I am trying to extract the all tweets which contain specific keyword and its geo locations . for example , I want download all the tweets in english which contains the keyword 'iphone' from 'france' and 'singapore' My code import tweepy import…
Rahul rajan
  • 1,186
  • 4
  • 18
  • 32
8
votes
1 answer

Get list of followers and following for group of users tweepy

I was just wondering if anyone knew how to list out the usernames that a twitter user is following, and their followers in two separate .csv cells. This is what I have tried so far. import tweepy import csv consumer_key = "" consumer_secret =…
user9663765
8
votes
3 answers

Tweepy error code 400

I am trying to download some tweets for research purpose the code worked very well until a few days ago. Error Message > Traceback (most recent call last): > > File "", line 1, in > …
Sitz Blogz
  • 1,061
  • 6
  • 30
  • 54
8
votes
2 answers

Using Tweepy to Access Twitter's Premium API

I want to access Twitter's archive without being restricted by rate limits or number of queries. I don't mind paying for this, so my plan was to sign up for the premium package on Twitter's API platform. As I'm familiar with Tweepy, I had hoped to…
Lodore66
  • 1,125
  • 4
  • 16
  • 34
8
votes
1 answer

tkinter.TclError: character U+1f449 is above the range (U+0000-U+FFFF) allowed by Tcl

I am trying to show my twitter timeline on Tkinter window using tweepy. This is the code import tweepy import tkinter consumer_key = 'xxxxxxxxxxxxxx' consumer_sec ='xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' acc_token =…
beginner
  • 2,366
  • 4
  • 29
  • 53
8
votes
2 answers

How to extract information from Tweepy ResultSet

How do I interact with the Tweepy Result set? How can I extract information? It kinda looks like a list or a dictionary, but I'm having trouble extracting specific elements of it. import tweepy auth = tweepy.OAuthHandler(consumer_key,…
Nate
  • 2,113
  • 5
  • 19
  • 25
8
votes
2 answers

Invalid or expired token. Request new token via Tweepy?

tweepy.error.TweepError: [{u'message': u'Invalid or expired token.', u'code': 89}] Do tokens have to be hard coded? I have the OAuth and access tokens hard coded right now, but the token seems to expire every 24 hours. What can I do to renew the…
User
  • 23,729
  • 38
  • 124
  • 207