Twitter: Difference between revisions

m
Changed name of tab from "API Keys" to "Keys and Access Tokens" as it is now named
imported>Mydiemho
m (update instruction for access setting)
imported>Clarkkarenl
m (Changed name of tab from "API Keys" to "Keys and Access Tokens" as it is now named)
 
(4 intermediate revisions by 2 users not shown)
Line 49:
 
* Start at the app information page. (Make sure you are on the '''Details''' tab.)
* Switch to the '''Keys and Access Tokens''' tab.
* At the endbottom of the page, under the "Your access token" section, there is a button - "Create my Accessaccess Tokentoken" , click on this to generate the access_token_key and access_token_secret. Once you get the confirmation that your app's access tokens have been created, you can go torefresh the "OAuthpage tool"and tabyou'll onsee the same page andthat all your app's credentials will be listed and are to be kept confidential.
* Write down the below credentials Twitter just created for your application, or just keep the browser tab open:
** API key
** consumer_key
** API secret
** consumer_secret
** Access token
** access_token_key
** Access token secret
** access_token_secret
 
Once you have the above mentioned details, you can use the skeleton code shared below.
Line 85 ⟶ 86:
# 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>.
# Find <code>GetSearch</code> in the TwitterPython librarywrapper codefor Twitter at https://github.com/bear/python-twitter/blob/master/twitter/api.py. What other options could we have passed to <code>GetSearch</code>?
 
<b>Check your understanding</b>: What does <code>api.GetSearch</code> return?
Line 94 ⟶ 95:
# Read through the <code>trendingTopics</code> function in <code>twitter_functions.py</code>.
# Trace through the logic in <code>twitter_api.py</code> that turns the <code>--trending-topics</code> command line option into a call to <code>search</code>.
# Find <code>GetTrendsWoeid</code> in the TwitterPython librarywrapper codefor Twitter at https://github.com/bear/python-twitter/blob/master/twitter/api.py. How many trending topics does that method return?
 
<b>Check your understanding</b>: What are the differences between the <code>optparse</code> logic for <code>--search</code> and <code>--trending-topics</code>?
Line 166 ⟶ 167:
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_WOEID</code> to only display results for Boston.
 
You can look up WOEIDs by location at http://sigizmundwoeid.info/woeidinforosselliot.co.nz/
 
 
===Congratulations!===
Anonymous user