Chicago Python Workshop/Chicago Python Workshop 1/Saturday projects/Twitter: Difference between revisions

imported>Aisha
 
(6 intermediate revisions by 3 users not shown)
Line 19:
# Run <code>python twitter_api.py --search</code> with various search terms, e.g.
#* <code>python twitter_api.py --search=Python</code>
#* <code>python twitter_api.py --search="RedWhite Sox"</code>
#* <code>python twitter_api.py --search="Cubs"</code>
# Read through the <code>search</code> function in <code>twitter_functions.py</code>.
# Trace through the logic in <code>twitter_api.py</code> that turns the <code>--search</code> command line option into a call to <code>search</code>.
Line 25 ⟶ 26:
 
<b>Check your understanding</b>: What does <code>api.GetSearch</code> return?
 
 
=== 2. Read through and understand <code>trendingTopics</code> ===
Line 69:
For example,
 
<pre>python twitter_api.py -u bostonpythonOrbitz</pre></li>
or,
<pre>python twitter_api.py -u zoro_tools</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!
Line 92 ⟶ 95:
</ol>
 
<b>Check your understanding</b>: What is the purpose of <code>BOSTON_WOEIDCHICAGO_WOEID</code> in <code>twitter_functions.py</code>?
 
== Bonus exercises ==
Line 113 ⟶ 116:
=== 2. Print trending topics by location ===
 
Extend <code>trendingTopics</code> so that a Yahoo! Where On Earth ID (WOEID) can be specified on the command line and trending topics for that location will be displayed instead of using the hardcoded <code>BOSTON_WOEIDCHICAGO_WOEID</code> to only display results for BostonChicago.
 
You can look up WOEIDs by location at http://sigizmund.info/woeidinfo/
 
 
===Congratulations!===
Anonymous user