")# Get the members of tamtar's list "Things That Are Rad"t.lists.members(owner_screen_name="tamtar", slug="things-that-are-rad")# An *optional* `_timeout` parameter can also be used for API# calls which take much more time than normal or twitter stops# responding for some reason:t.users.lookup( screen_name=','.join(A_LIST_OF_100_SCREEN_NAMES), _timeout=1)# Overriding Method: GET/POST# you should not need to use this method as this library properly# detects whether GET or POST should be used, Nevertheless# to force a particular method, use `_method`t.statuses.oembed(_id=1234567890, _method='GET')# Send images along with your tweets:# - first just read images from the web or from files the regular way:with open("example.png", "rb") as imagefile: imagedata = imagefile.read()# - then upload medias one by one on Twitter's dedicated server# and collect each one's id:t_up = Twitter(domain='upload.twitter.com', auth=OAuth(token, token_key, con_secret, con_secret_key))id_img1 = t_up.media.upload(media=imagedata)["media_id_string"]id_img2 = t_up.media.upload(media=imagedata)["media_id_string"]# - finally send your tweet with the list of media ids:t.statuses.update(status="PTT ★", media_ids=",".join([id_img1, id_img2]))# Or send a tweet with an image (or set a logo/banner similarily)# using the old deprecated method that will probably disappear some dayparams = # Or for an image encoded as base64:params = t.statuses.update_with_media(**params)```Searching Twitter:```python# Search for the latest tweets about #pycont.search.tweets(q="#pycon")```Retrying after reaching the API rate limit------------------------------------------Simply create the `Twitter` instance with the argument `retry=True`, then the HTTP error codes 429, 502, 503 and 504 will cause a retry of the last request.If retry is an integer, it defines the number of retries attempted.
Get help() on these classes to learn how to use them. Working with OAuth------------------Visit the Twitter developer page and create a new application:**[https://dev.twitter.com/apps/new](https://dev.twitter.com/apps/new)**This will get you a CONSUMER_KEY and CONSUMER_SECRET.
When users run your application they have to authenticate your appwith their Twitter account.
A few HTTP calls to twitter are requiredto do this.
Please see the twitter.oauth_dance module to see how thisis done.
Inthis mode, the iterator always yields immediately. Note that `timeout` supercedes thisargument, so it should also be set `None` to use this mode, and non-blocking can potentially lead to 100% CPU usage.
Twitter Response Objects------------------------Response from a twitter request.
The bot announces all tweets from friendsit is following.
It can be made to follow or leave friends through IRC /msgcommands.twitter-log-----------`twitter-log` is a simple command-line tool that dumps all publictweets from a given user in a simple text format.
When theconnection breaks, the iterator yields ``, andraises `Stop Iteration` if iterated again.