Skip to main content
# Twitterspawn

Asynchronous, concurrent requests to the Twitter REST API, that respect Twitter's rate limits, using [gevent](http://www.gevent.org/) and [requests](http://docs.python-requests.org/).

See [example.py](https://github.com/swinton/twitterspawn/blob/develop/example.py) for a working example.

## Usage
Basically:

```python
import twitterspawn

# Define callback (can define 1 per request)
def callback(response, worker):
print "Got", response, "from", worker

# Add requests + callbacks
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)

# Add workers
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")
# ...add as many more workers as required...
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")

# Go!
twitterspawn.go()
```

See also [example.py](https://github.com/swinton/twitterspawn/blob/develop/example.py) for a working example.

## Installation
Simply:

$ pip install twitterspawn

## Contact

@[steveWINton](https://twitter.com/steveWINton).

Release files for twitterspawn 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twitterspawn 0.2.0
File Size Uploaded
twitterspawn-0.2.0.tar.gz 4.2 kB Details

Release files / twitterspawn-0.2.0.tar.gz

Download URL twitterspawn-0.2.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
faebeb455dad5ee3219456f9bb7a60d3cbd8b62b8bf08771caaf83dbd0b83fd7
BLAKE2b-256 checksum
How to use checksums
dd24e1729cac92c32e4f946a90eb56b3ea4819e397f45576e7ce075f9c6a48a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page