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

How to fetch follower names of a profile from Twitter?

I am new to python and Twython and I want to fetch a list of all followers of a user and hence I am using this code twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) followers = twitter.get_followers_list(screen_name =…
coder
  • 183
  • 9
0
votes
1 answer

cannot import name WebApplicationClient

I am trying to run this program but I am receiving this error: python questions_app.py Traceback (most recent call last): File "questions_app.py", line 8, in from filter_daemon import * File…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
0
votes
1 answer

SSL unknown protocol error using Twython on Python 2.6

I'm trying to run Twython behind a proxy. Here are the client_args: client_args = { 'verify': False, 'headers': { 'User-Agent': 'AgentName' }, 'proxies': { 'http': 'proxy:port_number', 'https': 'proxy:port_number' }, 'timeout':…
0
votes
1 answer

'str' object has no attribute 'disconnect'

What`s wrong with the method? 'stream' is the method name I declared for it to start the streamer and it works. However when I wrote this method to disconnect the streamer, it have error saying that 'str' object has no attribute 'disconnect'. Can…
Joseph Lee
  • 15
  • 4
0
votes
0 answers

How to stop the twython streamer using pickle?

How to stop the twython streamer using pickle? def twitter_stop(request): stream = request.session['stream'] pickle.dumps('models.pyc') stream = pickle.load(pkl_file) stream.disconnect() return HttpResponse(request) The above are my codes and I…
Joseph Lee
  • 15
  • 4
0
votes
1 answer

search stopping when receiving an error

I'm trying to loop through a list of tweet ID's but if I encounter one that no longer exists I receive a 404 error and the script just stops. I've tried something like this: try: twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN,…
0
votes
2 answers

Is it possible to stop twython streaming at certain point of time?

I have the codes for twython streaming and it is working. def read_cred(file): in_handle = open(file,'r') cred = {} for ln in in_handle: data = ln.strip('\r\n').split('=') if len(data) > 1: key = data[0].strip(' ').lower() …
Slow learner
  • 171
  • 1
  • 1
  • 7
0
votes
1 answer

Not able find Twython.getFollowersIDs functions

I am using Twython on Ubuntu 12.04 an when I write this line twitter.getFollowersIDs(screen_name='someName') I am getting this error AttributeError: 'Twython' object has no attribute 'getFollowersIDs' what should I do?
coder
  • 183
  • 9
0
votes
2 answers

Exception shows up in wrong place

In the t.cursor() method, an exception from the Twython library is thrown for a small percentage of ids. However, whenever the exception occurs, the actual line in my code where it's thrown is the for-loop that comes after the try/except block,…
jimbotron
  • 655
  • 1
  • 5
  • 8
0
votes
2 answers

python3 encode errors, confusion (using twython)

This is my first time trying out python in a very long time. I am trying to simply extract and print tweets to console using twython. tw = Twython(APP_KEY, access_token=access_token) search = tw.search(q='#python') for tweet in search["statuses"]: …
0
votes
1 answer

Twitter streaming seems to have a latency of one tweet always

There seems to be a latency of one tweet when streaming from twitter. Scenario Start the streaming with a track parameter, say "oopsnotworking" Tweet a tweet containing the "oopsnotworking" The stream does not seem to pick it up Tweet another…
chipmunk
  • 944
  • 8
  • 19
0
votes
3 answers

Proxy using Twython

I keep getting this error everytime I try running my code through proxy. I have gone through every single link available on how to get my code running behind proxy and am simply unable to get this done. import twython import requests TWITTER_APP_KEY…
Sufiyan
  • 23
  • 4
0
votes
2 answers

SSL Error in Twython GET

I am playing with the twython and requests packages and found something strange which is blocking my code to retrive the tweets. I am working behind the firewall if it helps. Code: from twython import Twython t =…
LonelySoul
  • 1,212
  • 5
  • 18
  • 45
0
votes
1 answer

Authentication with twython

app_key=" " app_secret=" " twitter = Twython(app_key=app_key, app_secret=app_secret) auth_props = twitter.get_authentication_tokens() oauth_token = auth_props['oauth_token'] oauth_token_secret = auth_props['auth_url'] print 'Connect to Twitter…
0
votes
1 answer

error occurring while using 'twython'

I want to fetch tweets based on hashtags. But I get the below error. >>> import twython >>> TWITTER_APP_KEY = 'xxxxxx' >>> TWITTER_APP_KEY_SECRET = 'xxxxx' >>> TWITTER_ACCESS_TOKEN = 'xxxxxx' >>> TWITTER_ACCESS_TOKEN_SECRET = 'xxxxx' >>> t =…
user1946217
  • 1,733
  • 6
  • 31
  • 40