Twitter: Difference between revisions

517 bytes added ,  11 years ago
imported>Jesstess
imported>Jesstess
Line 47:
 
<b>Check your understanding</b>: What does <code>api.GetSearch</code> return?
 
 
=== 2. Read through and understand <code>trendingTopics</code> ===
Line 59 ⟶ 60:
=== 3. Implement <code>userTweets</code> ===
 
<ol>
# <li>Using the <code>search</code> and <code>trendingTopics</code> functions as a reference, implement <code>userTweets</code> in <code>twitter_functions.py</code>.
 
This function should print recent tweets by the username provided on the command line.
 
You may find the <code>twitter.Api()</code> function <code>GetUserTimeline()</code> helpful.</li>
<li>We've already written some <code>optparse</code> logic for <code>userTweets</code> in <code>twitter_api.py</code>. Read through that logic. In what ways is it the same/different from the logic for <code>search</code>?
 
To<li>Test test thisyour function,. atYou thecan commanddo linethis runwith:
 
<pre>python twitter_api.py -u <username></pre>
Line 71 ⟶ 73:
For example,
 
<pre>python twitter_api.py -u bostonpython</pre></li>
 
You should see 20 tweets by the provided username. If you have a Twitter account, try running it on yourself, tweeting something new, and running it again!
</ol>
 
<b>Check your understanding</b>: What are the two ways to pass command line arguments for <code>userTweets</code>?
 
 
Anonymous user