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
2 answers

Twython to extract tweets

I am using Twython twitter API to extract tweets. But I am getting 100 tweets only. I want to extract tweets from 10Dec 2013 to 10March 2014. I have mentioned count=1000 in the search function. The rate limit is 100 I get that. Is there a way to…
blackmamba
  • 1,952
  • 11
  • 34
  • 59
0
votes
1 answer

Twython Info for more than one screen name

Using Van Ling script on how to get a users url I adapted it and found two things I was looking for, one was to know the number of followers a certain screen name had so I used 'followers_count' instead of 'profile_image-url' I also wanted more…
0
votes
1 answer

Twython basic, helpm please , can it get easier than this?

This script is giving ma a 500 Error, any ideas? I am taking the script from a page from python samples and also using the path given to me by my hosting company (and I know it works because I have another script that does work.) The file has 755…
0
votes
1 answer

Twython update_status_with_media error

I have the following code: photo = open(os.path.join("images", localFileName), 'rb') tweetThis = "status" twitter.update_status_with_media(status=tweetThis, media=photo) Here is the traceback: twitter.update_status_with_media(status=status,…
Morki
  • 215
  • 1
  • 3
  • 11
0
votes
0 answers

Reconnects a stream using Twython

I’m making a Twitter application using Python and Twython. I’m using the Twitter’s Stream API. It seems to work fine, but when the internet connection its down for a time, the stream cannot reconnect when the connection returns. The idea is that if…
0
votes
2 answers

Cannot import Twython

I installed Twython 1.2 using the Windows installer at this link: https://pypi.python.org/pypi/twython/1.2. The installer seems to run fine. I get the error "ImportError: cannot import name Twython" when I try to do: from twython import Twython from…
The Dude
  • 330
  • 6
  • 16
0
votes
1 answer

Get screen name - twython

Total noob to this. I have set up a script that can send a tweet, all I want to do is print text before the enter message promt that displays the screen name of the account. In my mind it would be something like user_name =…
Neil T
  • 11
  • 3
0
votes
1 answer

Using Twython to correctly navigate a users tweets

I am trying to use Twython to retrieve the last tweet an account makes. My current code is: try: user_timeline = twitter.get_user_timeline(screen_name='Twitter') except TwythonError as e: print e for tweets in user_timeline: print…
AllynH
  • 167
  • 1
  • 1
  • 14
0
votes
2 answers

How many direct messages does twitter store?

I've read the Twitter REST API docs, I know that it says you can fetch 200 at a time to a max of 800. However... I can't. I'm pulling 200, using the last tweet as max_id and then sending another request but I only receive the last tweet from the…
Brian
  • 22
  • 6
0
votes
2 answers

Twython get followers count

Is there an easy way to get the number of followers an account has without having to loop through cursors? I'm looking for a simple function call which will return to me just the number of followers the use with a given Twitter ID has. Just looking…
Matt Stokes
  • 4,618
  • 9
  • 33
  • 56
0
votes
1 answer

Trying update Twitter status with scraper data using Twython. Unsure on what to do

So I have these two scripts: redditScraper.py # libraries import urllib2 import json # get remote string url = 'http://www.reddit.com/new.json?sort=new' response=urllib2.urlopen(url) # interpret as json data =…
0
votes
1 answer

Twython rate limit

I am getting a 'TwythonRateLimitError' and want to be sure that I don't screw up my account. I am new to working with the Twitter API. How can I check to make sure that I am not going over my query limit? I read that it is 150 queries/hour...…
Timo Loescher
  • 119
  • 1
  • 1
  • 16
0
votes
1 answer

Python: Twitter scraping using "request(POST)" function

I am trying to use twython package to scrap twitter data. Due to the huge number of twitter handles that I am dealing with, I cannot use twitter.lookup_user(user_id=user_batch) command - so I instead tried to use user_dict_batch =…
Jin-Dominique
  • 3,043
  • 6
  • 19
  • 28
0
votes
1 answer

Failing to pull a sampling of Twitter users

I am doing a project for which I need a fairly small number of random Twitter users (about 20 for now) with a near-identical number of followers (within 45000 - 55000 for example). I brushed up on my Python, got Twython set up, and did some test…
Timo Loescher
  • 119
  • 1
  • 1
  • 16
0
votes
1 answer

Twython 401 error when trying to update with media

I am trying to get my raspberry pi to watch twitter for tweets at a certain user using a certain hashtag. When it sees a tweet that meets the criteria, it should take a picture and then tweet the picture back at the user. It works up until the point…