From 589e847117ce92cb0a8213bf0cd362ff0f7f583e Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 4 Dec 2018 09:51:53 -0600 Subject: [PATCH] Fix grammatical mistakes in cursor tutorial --- docs/cursor_tutorial.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/cursor_tutorial.rst b/docs/cursor_tutorial.rst index a4e6e44..57a4612 100644 --- a/docs/cursor_tutorial.rst +++ b/docs/cursor_tutorial.rst @@ -11,16 +11,16 @@ Introduction We use pagination a lot in Twitter API development. Iterating through timelines, user lists, direct messages, etc. In order to perform -pagination we must supply a page/cursor parameter with each of our +pagination, we must supply a page/cursor parameter with each of our requests. The problem here is this requires a lot of boiler plate code just to manage the pagination loop. To help make pagination easier and -require less code Tweepy has the Cursor object. +require less code, Tweepy has the Cursor object. Old way vs Cursor way --------------------- First let's demonstrate iterating the statuses in the authenticated -user's timeline. Here is how we would do it the "old way" before +user's timeline. Here is how we would do it the "old way" before the Cursor object was introduced:: page = 1 @@ -35,8 +35,8 @@ Cursor object was introduced:: break page += 1 # next page -As you can see we must manage the "page" parameter manually in our -pagination loop. Now here is the version of the code using Cursor +As you can see, we must manage the "page" parameter manually in our +pagination loop. Now here is the version of the code using the Cursor object:: for status in tweepy.Cursor(api.user_timeline).items(): @@ -44,7 +44,7 @@ object:: process_status(status) Now that looks much better! Cursor handles all the pagination work for -us behind the scene so our code can now focus entirely on processing +us behind the scenes, so our code can now focus entirely on processing the results. Passing parameters into the API method @@ -62,14 +62,14 @@ Cursor constructor method:: tweepy.Cursor(api.user_timeline, id="twitter") -Now Cursor will pass the parameter into the method for us when ever it +Now Cursor will pass the parameter into the method for us whenever it makes a request. Items or Pages -------------- -So far we have just demonstrated pagination iterating per an -item. What if instead you want to process per a page of results? You +So far we have just demonstrated pagination iterating per +item. What if instead you want to process per page of results? You would use the pages() method:: for page in tweepy.Cursor(api.user_timeline).pages(): @@ -96,10 +96,10 @@ What if you only want n items or pages returned? You pass into the items() or pa Include Tweets > 140 Characters ------------------------------- -Since twitter increased the maximum characters allowed in a tweet from 140 to 280, you may notice that tweets greater than 140 characters are truncated with a ... -If you want your results to include the full text of the long tweets make these simple changes: +Since twitter increased the maximum number of characters allowed in a tweet from 140 to 280, you may notice that tweets greater than 140 characters are truncated with ... +If you want your results to include the full text of the long tweets, make these simple changes: - add the argument tweet_mode='extended' to your Cursor object call -- change your usages of .text to .full_text +- change your usage of .text to .full_text .. code-block :: python -- 2.25.1