Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
geduldig committed Aug 3, 2015
1 parent 09d297c commit 3d1997e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,24 @@ First, authenticate with your application credentials::
Tweet something::

r = api.request('statuses/update', {'status':'This is a tweet!'})
print r.status_code
print(r.status_code)

Get tweet by its id::

r = api.request('statuses/show/:%d' % 210462857140252672)
print(r.text)

Get some tweets::

r = api.request('search/tweets', {'q':'pizza'})
for item in r:
print item
print(item)

Stream tweets from New York City::

r = api.request('statuses/filter', {'locations':'-74,40,-73,41'})
for item in r:
print item
print(item)
Notice that ``request()`` accepts both REST and Streaming API methods, and it takes two arguments: the Twitter method, and a dictionary of method parameters. In the above examples we use ``get_iterator()`` to get each tweet object. The iterator knows how to iterate both REST and Streaming API results. Alternatively, you have access to the response object returned by ``request()``. From the response object ``r`` you can get the raw response with ``r.text`` or the HTTP status code with ``r.status_code``. See the `requests <http://docs.python-requests.org/en/latest/user/quickstart/>`_ library documentation for more details.

Expand Down
2 changes: 1 addition & 1 deletion TwitterAPI/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'TwitterAPI'
__version__ = '2.3.3.3'
__version__ = '2.3.3.4'
__author__ = 'Jonas Geduldig'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013 Jonas Geduldig'
Expand Down

0 comments on commit 3d1997e

Please sign in to comment.