]> jfr.im git - z_archive/twitter.git/commitdiff
Minor README.md tweaks
authorZearin <redacted>
Fri, 4 Dec 2015 16:32:29 +0000 (11:32 -0500)
committerZearin <redacted>
Fri, 4 Dec 2015 16:32:29 +0000 (11:32 -0500)
README

diff --git a/README b/README
index 52d9d12fd4322735ff347b7674034e46c0dbda02..94d07e4281641ace96b7e31e1edabe9bb7612168 100644 (file)
--- a/README
+++ b/README
@@ -7,17 +7,16 @@ The Minimalist Twitter API for Python is a Python API for Twitter,
 everyone's favorite Web 2.0 Facebook-style status updater for people
 on the go.
 
-Also included is a twitter command-line tool for getting your friends'
+Also included is a Twitter command-line tool for getting your friends'
 tweets and setting your own tweet from the safety and security of your
 favorite shell and an IRC bot that can announce Twitter updates to an
 IRC channel.
 
 For more information, after installing the `twitter` package:
 
- * import the `twitter` package and run help() on it
+ * import the `twitter` package and run `help()` on it
  * run `twitter -h` for command-line tool help
 
-
 twitter - The Command-Line Tool
 -------------------------------
 
@@ -30,42 +29,40 @@ The command-line tool lets you do some awesome things:
 
 The bottom line: type `twitter`, receive tweets.
 
-
-
 twitterbot - The IRC Bot
 ------------------------
 
-The IRC bot is associated with a twitter account (either your own account or an
+The IRC bot is associated with a Twitter account (either your own account or an
 account you create for the bot). The bot announces all tweets from friends
 it is following. It can be made to follow or leave friends through IRC /msg
 commands.
 
 
-twitter-log
------------
+`twitter-log`
+-------------
 
 `twitter-log` is a simple command-line tool that dumps all public
 tweets from a given user in a simple text format. It is useful to get
 a complete offsite backup of all your tweets. Run `twitter-log` and
 read the instructions.
 
-twitter-archiver and twitter-follow
------------------------------------
+`twitter-archiver` and `twitter-follow`
+---------------------------------------
 
 twitter-archiver will log all the tweets posted by any user since they
 started posting. twitter-follow will print a list of all of all the
 followers of a user (or all the users that user follows).
 
 
-Programming with the Twitter api classes
+Programming with the Twitter API classes
 ========================================
 
-The Twitter and TwitterStream classes are the key to building your own
+The `Twitter` and `TwitterStream` classes are the key to building your own
 Twitter-enabled applications.
 
 
-The Twitter class
------------------
+The `Twitter` class
+-------------------
 
 The minimalist yet fully featured Twitter API class.
 
@@ -77,6 +74,7 @@ The Twitter API is documented at:
 **[https://dev.twitter.com/overview/documentation](https://dev.twitter.com/overview/documentation)**
 
 Examples:
+
 ```python
 from twitter import *
 
@@ -151,8 +149,10 @@ 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.
+HTTP error codes `429`, `502`, `503`, and `504` will cause a retry of the last 
+request. 
+
+If `retry` is an integer, it defines the maximum number of retry attempts.
 
 
 Using the data returned
@@ -175,7 +175,7 @@ Getting raw XML data
 --------------------
 
 If you prefer to get your Twitter data in XML format, pass
-format="xml" to the Twitter object when you instantiate it:
+`format="xml"` to the `Twitter` object when you instantiate it:
 
 ```python
 twitter = Twitter(format="xml")
@@ -184,12 +184,11 @@ twitter = Twitter(format="xml")
 The output will not be parsed in any way. It will be a raw string
 of XML.
 
+The `TwitterStream` class
+-------------------------
 
-The TwitterStream class
------------------------
-
-The TwitterStream object is an interface to the Twitter Stream
-API. This can be used pretty much the same as the Twitter class
+The `TwitterStream` object is an interface to the Twitter Stream
+API. This can be used pretty much the same as the `Twitter` class,
 except the result of calling a method will be an iterator that
 yields objects decoded from the stream. For example::
 
@@ -201,7 +200,7 @@ for tweet in iterator:
     ...do something with this tweet...
 ```
 
-Per default the ``TwitterStream`` object uses
+Per default the `TwitterStream` object uses
 [public streams](https://dev.twitter.com/docs/streaming-apis/streams/public).
 If you want to use one of the other
 [streaming APIs](https://dev.twitter.com/docs/streaming-apis), specify the URL
@@ -213,9 +212,9 @@ manually:
 
 Note that you require the proper
 [permissions](https://dev.twitter.com/docs/application-permission-model) to
-access these streams. E.g. for direct messages your
+access these streams. (E.g., for direct messages, your
 [application](https://dev.twitter.com/apps) needs the "Read, Write & Direct
-Messages" permission.
+Messages" permission.)
 
 The following example demonstrates how to retrieve all new direct messages
 from the user stream:
@@ -233,14 +232,14 @@ for msg in twitter_userstream.user():
         print msg['direct_message']['text']
 ```
 
-The iterator will yield until the TCP connection breaks. When the
-connection breaks, the iterator yields `{'hangup': True}`and
-raises `StopIteration` if iterated again.
+The iterator will `yield` until the TCP connection breaks. When the
+connection breaks, the iterator yields `{'hangup': True}` (and
+raises `StopIteration` if iterated again).
 
 Similarly, if the stream does not produce heartbeats for more than
-90 seconds, the iterator yields `{'hangup': True,
-'heartbeat_timeout': True}`, and raises `StopIteration` if
-iterated again.
+90 seconds, the iterator yields `{'hangup': True, 
+'heartbeat_timeout': True}` (and raises `StopIteration` if 
+iterated again).
 
 The `timeout` parameter controls the maximum time between
 yields. If it is nonzero, then the iterator will yield either
@@ -248,28 +247,30 @@ stream data or `{'timeout': True}` within the timeout period. This
 is useful if you want your program to do other stuff in between
 waiting for tweets.
 
-The `block` parameter sets the stream to be fully non-blocking. In
-this mode, the iterator always yields immediately. It returns
-stream data, or `None`. Note that `timeout` supercedes this
-argument, so it should also be set `None` to use this mode, 
-and non-blocking can potentially lead to 100% CPU usage.
+The `block` parameter sets the stream to be fully non-blocking. 
+In this mode, the iterator always yields immediately. It returns
+stream data, or `None`. 
 
-Twitter Response Objects
-------------------------
+Note that `timeout` supercedes this argument, so it should also be 
+set `None` to use this mode, and non-blocking can potentially lead 
+to 100% CPU usage.
 
-Response from a twitter request. Behaves like a list or a string
-(depending on requested format) but it has a few other interesting
+Twitter `Response` Objects
+--------------------------
+
+Response from a Twitter request. Behaves like a list or a string
+(depending on requested format), but it has a few other interesting
 attributes.
 
 `headers` gives you access to the response headers as an
-httplib.HTTPHeaders instance. You can do
-`response.headers.get('h')` to retrieve a header.
+`httplib.HTTPHeaders` instance. Use `response.headers.get('h')` 
+to retrieve a header.
 
 Authentication
 --------------
 
 You can authenticate with Twitter in three ways: NoAuth, OAuth, or
-OAuth2 (app-only). Get help() on these classes to learn how to use them.
+OAuth2 (app-only). Get `help()` on these classes to learn how to use them.
 
 OAuth and OAuth2 are probably the most useful.
 
@@ -281,23 +282,23 @@ 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.
+This will get you a `CONSUMER_KEY` and `CONSUMER_SECRET`.
 
 When users run your application they have to authenticate your app
-with their Twitter account. A few HTTP calls to twitter are required
-to do this. Please see the twitter.oauth_dance module to see how this
+with their Twitter account. A few HTTP calls to Twitter are required
+to do this. Please see the `twitter.oauth_dance` module to see how this
 is done. If you are making a command-line app, you can use the
-oauth_dance() function directly.
+`oauth_dance()` function directly.
 
-Performing the "oauth dance" gets you an ouath token and oauth secret
+Performing the "oauth dance" gets you an oauth token and oauth secret
 that authenticate the user with Twitter. You should save these for
-later so that the user doesn't have to do the oauth dance again.
+later, so that the user doesn't have to do the oauth dance again.
 
-read_token_file and write_token_file are utility methods to read and
-write OAuth token and secret key values. The values are stored as
+`read_token_file` and `write_token_file` are utility methods to read and
+write OAuth `token` and `secret` key values. The values are stored as
 strings in the file. Not terribly exciting.
 
-Finally, you can use the OAuth authenticator to connect to Twitter. In
+Finally, you can use the `OAuth` authenticator to connect to Twitter. In
 code it all goes like this:
 
 ```python
@@ -317,8 +318,8 @@ twitter = Twitter(auth=OAuth(
 twitter.statuses.update(status='Hello, world!')
 ```
 
-Working with OAuth2
--------------------
+Working with `OAuth2`
+---------------------
 
 Twitter only supports the application-only flow of OAuth2 for certain
 API endpoints. This OAuth2 authenticator only supports the application-only
@@ -329,12 +330,12 @@ application:
 
 **[https://dev.twitter.com/apps/new](https://dev.twitter.com/apps/new)**
 
-This will get you a CONSUMER_KEY and CONSUMER_SECRET.
+This will get you a `CONSUMER_KEY` and `CONSUMER_SECRET`.
 
-Exchange your CONSUMER_KEY and CONSUMER_SECRET for a bearer token using the
-oauth2_dance function.
+Exchange your `CONSUMER_KEY` and `CONSUMER_SECRET` for a bearer token using the
+`oauth2_dance` function.
 
-Finally, you can use the OAuth2 authenticator and your bearer token to connect
+Finally, you can use the `OAuth2` authenticator and your bearer token to connect
 to Twitter. In code it goes like this::
 
 ```python