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

twython search string limit with twitter api : results missing

Hello I am super new to coding, still in the phase, copy paste, learn, change some variables, run, cross fingers, bang fist or raise fist...etc. I have created a twitter bot using this tutorial my code is as follows import time from twython import…
B. Chas
  • 51
  • 1
  • 6
0
votes
1 answer

twython inheritance variable

I'm trying to extend a class, TwythonStreamer in twython. Followed: [Inheritance and Overriding __init__ in python. Redefining the on_success method which works fine. My problem is adding a count variable and initializing it to zero. I get the error…
Jim Smith
  • 457
  • 5
  • 9
0
votes
1 answer

Can I make an httplib POST request that returns a status of 500 from my Twython callback handler?

In my callback handler from twitter, I cannot seem to make a httplib POST request as it throws an unrelated 401 Token Invalid Expired error. I'm using Google App Engine and have tried the urlfetch function as well. headers = {"Content-type":…
user1961
  • 1,270
  • 2
  • 17
  • 27
0
votes
1 answer

twython upload_media from tempfiles

So I was writing a bot that pulls images from wikipedia (with requests) and posts them to twitter (with twython). I found this, which led me to believe I could do something like import tempfile import twython import requests ... req =…
swizzard
  • 1,037
  • 1
  • 12
  • 28
0
votes
1 answer

Get the error codes in Twython exceptions in python

I want to capture the error codes due to which exception occurs in twython. How can that be done? Right now, I am only able to capture the TwythonAuthError for protected accounts but not for errors like 403 or 404 etc. I want to save these error…
POOJA GUPTA
  • 2,295
  • 7
  • 32
  • 60
0
votes
1 answer

Unable to fetch more than 100 tweets using Twython

I have the following script: twitter=Twython(consumer_key, consumer_secret, access_token, access_token_secret) tags=['#pc', #computer', '#technology'] for tag in tags: try: search_results=twitter.search(q=tag, count=200) except…
MLSC
  • 5,872
  • 8
  • 55
  • 89
0
votes
1 answer

Authorize application to use twitter ads api via OAuth2

I'm using Python's Twython library and want to get access to Twitter Ads API. I've register application and gain app id and app secret key and also get access token. How I can authorize my own application to get access to my own Twitter Ads…
drjackild
  • 473
  • 4
  • 17
0
votes
1 answer

Using Twython to get user ID's from a list of screen names (Twitter API)

I have the code below, which works for querying the Twitter API for screen names, based on a list of known ID's. I want to go the other way around: knowing the screen names, and getting the ID's. from twython import Twython # Paste your codes…
Simon Lindgren
  • 2,011
  • 12
  • 32
  • 46
0
votes
1 answer

Filter tweet keywords

I'm trying to filer certain words with Twython before retweeting. I can't figure out a way to get it to work and instead of filtering out certain words, it's adding those words to the ones to retweet. Here is my code: naughty_words = ["",'"Sign…
Alex
  • 488
  • 2
  • 5
  • 20
0
votes
1 answer

Arbitrary character is added in json while using twitter api in Django

I am new to Django and I am using twython library for twitter search. I am getting json file where 'u' character is added before to key for eg. {u'search_metadata': {u'count': 15, u'completed_in': 0.028, u'max_id_str': u'640844327904800768',…
jeet
  • 27
  • 6
0
votes
1 answer

Track users and keywords with twitter streaming api twython

Currently I have stream.statuses.filter(track=['words','I',"want','to','track']) How do I also follow some users at the same time?
thekindlyone
  • 509
  • 1
  • 6
  • 21
0
votes
1 answer

Twython Api: IncompleteRead: IncompleteRead(0 bytes read, 1 more expected)

I am trying to use Twython Streaming API and I am getting the following error after some amount of time (arround 220+ tweets consumed) Here is the stacktrace where error happens. I have seen recommendations to upgrade requests library - but it's…
ig-melnyk
  • 2,769
  • 2
  • 25
  • 35
0
votes
1 answer

How can i capture the secret token to post users tweet - KeyError at / 'oauth_token_secret'

I have built a Django webpage with a text area and I would like a user of the site to be able to tweet the content of the text area. I have been able to post on my own account (with developer credentials), however I'm having trouble extracting the…
0
votes
1 answer

Twython: Get a list of all your followers except those who are on your muted list?

I have this block of code that gets my twitter followers using Twython. How would I modify this to instead do: "Get all your twitter followers who do not appear on your muted followers list" ? I tried doing a request twice, one for followers, and…
mishap_n
  • 578
  • 2
  • 10
  • 23
0
votes
0 answers

AttributeError: 'Twython' object has no attribute 'create_mute'

I'm just trying to use create_mute with Twython. But I keep getting this error and I'm not sure what I'm doing wrong. Python 2.7+ just running it locally out of my terminal to see if it works. from twython import Twython, TwythonError import sys ##…
mishap_n
  • 578
  • 2
  • 10
  • 23