Asynchronous, concurrent requests to the Twitter REST API, that respect Twitter's rate limits, using gevent and requests.
See example.py for a working example.
Usage
Basically:
import twitterspawn
def callback(response, worker):
print "Got", response, "from", worker
twitterspawn.add_request("https://api.twitter.com/1/users/show.json",
dict(params=dict(screen_name="steveWINton")),
callback)
twitterspawn.add_request("https://api.twitter.com/1/users/show.json",
dict(params=dict(screen_name="twitter")),
callback)
twitterspawn.add_request("https://api.twitter.com/1/users/show.json",
dict(params=dict(screen_name="catbinlady")),
callback)
twitterspawn.add_worker(access_token="YOUR_FIRST_ACCESS_TOKEN",
access_token_secret="YOUR_FIRST_ACCESS_TOKEN_SECRET",
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET")
twitterspawn.add_worker(access_token="YOUR_NEXT_ACCESS_TOKEN",
access_token_secret="YOUR_NEXT_ACCESS_TOKEN_SECRET",
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET")
twitterspawn.add_worker(access_token="YOUR_LAST_ACCESS_TOKEN",
access_token_secret="YOUR_LAST_ACCESS_TOKEN_SECRET",
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET")
twitterspawn.go()
See also example.py for a working example.
Installation
Simply:
$ pip install twitterspawn
Contact
@steveWINton.