Migrated from timeline-access v1

ryanmcgrath 2010-09-13 02:21:30 -07:00
parent 9cc099b882
commit c726a9c86d

87
Timeline-Access.textile Normal file

@ -0,0 +1,87 @@
Listed below are the various ways to access Twitter's different timeline permutations. Some require Authentication at certain points, so pay attention.
h2. getPublicTimeline()
Returns the public timeline. This is easily one of the simplest methods for getting data in all of Tango.
<pre>
<code>
import tango
# Getting the public timeline requires no authentication, huzzah
twitter = tango.setup()
public_timeline = twitter.getPublicTimeline()
for tweet in public_timeline:
print tweet["text"]
</code>
</pre>
h2. getFriendsTimeline()
Returns a timeline for all the users the authenticating user is following. This (obviously) requires authentication.
Parameters:
* <b>since_id:</b> (Optional) The farthest tweet id back in time that you want results on.
* <b>max_id:</b> (Optional) The closest tweet id in time that you want results on.
* <b>count:</b> (Optional) The amount of results you want back. Per Twitter, this may not be greater than 200.
* <b>page:</b> (Optional) The number of pages of results you want back.
<pre>
<code>
import tango
# Authenticate using Basic (HTTP) Authentication
twitter = tango.setup(authtype="Basic", username="example", password="example")
friends_timeline = twitter.getFriendsTimeline(count="150", page="3")
for tweet in friends_timeline:
print tweet["text"]
</code>
</pre>
h2. getUserTimeline()
Returns a timeline for the specified user. If no user is specified, and a user is currently authenticated, this method will return the timeline for the currently authenticated user. This requires authentication if the specified user has a private account (subsequently, you must be friends with them to get their timeline).
Parameters:
* <b>id:</b> (Optional) The id or screen name of the user you want a timeline for.
* <b>user_id:</b> (Optional) The id of the user you want a timeline for.
* <b>screen_name:</b> (Optional) The screen name of the user you want a timeline for.
* <b>since_id:</b> (Optional) The farthest tweet id back in time that you want results on.
* <b>max_id:</b> (Optional) The closest tweet id in time that you want results on.
* <b>count:</b> (Optional) The amount of results you want back. Per Twitter, this may not be greater than 200.
* <b>page:</b> (Optional) The number of pages of results you want back.
<pre>
<code>
import tango
# We won't authenticate for this, but sometimes it's necessary
twitter = tango.setup()
user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath")
print user_timeline
</code>
</pre>
h2. getFriendsTimeline()
Returns a set of 20 "@" mentions pertaining to the authenticating user (this, obviously, requires authentication).
Parameters:
* <b>since_id:</b> (Optional) The farthest tweet id back in time that you want results on.
* <b>max_id:</b> (Optional) The closest tweet id in time that you want results on.
* <b>count:</b> (Optional) The amount of results you want back. Per Twitter, this may not be greater than 200.
* <b>page:</b> (Optional) The number of pages of results you want back.
<pre>
<code>
import tango
twitter = tango.setup(authtype="Basic", username="example", password="example")
mentions = twitter.getUserMentions(count="150")
print mentions
</code>
</pre>