Created
August 20, 2012 13:33
-
-
Save swinton/3404080 to your computer and use it in GitHub Desktop.
Twitterspawn HOWTO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define callback (can define 1 per request) | |
| def callback(response): | |
| print "Got", response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Go! | |
| twitterspawn.go() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import twitterspawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ pip install twitterspawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Throttling... Sleeping for 13 secs... | |
| Throttling... Sleeping for 13 secs... | |
| Got <Response [200]> | |
| Got <Response [200]> | |
| Throttling... Sleeping for 13 secs... | |
| Got <Response [200]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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", | |
| header_auth=False) | |
| twitterspawn.add_worker(access_token="YOUR_SECOND_ACCESS_TOKEN", | |
| access_token_secret="YOUR_SECOND_ACCESS_TOKEN_SECRET", | |
| consumer_key="YOUR_CONSUMER_KEY", | |
| consumer_secret="YOUR_CONSUMER_SECRET", | |
| header_auth=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment