]> jfr.im git - z_archive/twitter.git/blobdiff - README
Changed special parameter timeout to _timeout so that it doesn't block any parameter...
[z_archive/twitter.git] / README
diff --git a/README b/README
index cc1f9f7fc36c7a5532375899382ce59325c7846d..9c01fdf182ac0ad4cf9b3a22a4e2d0abb2239762 100644 (file)
--- a/README
+++ b/README
@@ -77,9 +77,13 @@ The Twitter API is documented at:
 
 
 Examples::
+    
+    from twitter import *
 
+    # see "Authentication" section below for tokens and keys
     t = Twitter(
-        auth=OAuth(token, token_key, con_secret, con_secret_key)))
+        auth=OAuth(OAUTH_TOKEN, OAUTH_SECRET,
+                   CONSUMER_KEY, CONSUMER_SECRET)))
 
     # Get the public timeline
     t.statuses.public_timeline()
@@ -106,9 +110,16 @@ Examples::
     # into the middle of a call. You can also use replacement:
     t.user.list.members(user="tamtar", list="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 reasone
+    t.users.lookup(screen_name=','.join(A_LIST_OF_100_SCREEN_NAMES), _timeout=1)
+
 
 Searching Twitter::
 
+    from twitter import *
+
     twitter_search = Twitter(domain="search.twitter.com")
 
     # Find the latest search trends
@@ -213,6 +224,8 @@ strings in the file. Not terribly exciting.
 Finally, you can use the OAuth authenticator to connect to Twitter. In
 code it all goes like this::
 
+    from twitter import *
+
     MY_TWITTER_CREDS = os.path.expanduser('~/.my_app_credentials')
     if not os.path.exists(MY_TWITTER_CREDS):
         oauth_dance("My App Name", CONSUMER_KEY, CONSUMER_SECRET,
@@ -221,7 +234,7 @@ code it all goes like this::
     oauth_token, oauth_secret = read_token_file(MY_TWITTER_CREDS)
 
     twitter = Twitter(auth=OAuth(
-        oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET))
+        oauth_token, oauth_secret, CONSUMER_KEY, CONSUMER_SECRET))
 
     # Now work with Twitter
     twitter.statuses.update('Hello, world!')