Talk:Twitter: Difference between revisions

imported>Divya KV
(Error in "python twitter_api.py --search=python")
 
imported>Divya KV
(→‎Issue867 resolved: new section)
 
(One intermediate revision by one other user not shown)
Line 28:
Thanks,
Divya
 
 
:Hi Divya! You're right that this needs to be fixed to work with the new Twitter API - see [http://openhatch.org/bugs/issue867 this bug on the OpenHatch bugtracker]. Sorry about that! Unfortunately I don't know enough to fix it myself, but you can subscribe to that bug for updates on when it gets fixed. [[User:Brittag|Brittag]] ([[User talk:Brittag|talk]]) 00:39, 7 August 2013 (UTC)
 
== Issue867 resolved ==
 
Hi Brittag,
 
I was able to resolve the issue with help from [http://alteredqualia.com/texts/oauth/] and few modifications. The Twitter APIs can henceforth be accessed only through "Registered Twitter applications". In the process of the app registration we get what are called Consumer_Key, Consumer_Secret, Access_Token_Key and Access_Token_Secret - all four of which are to be fed into the twitter.Api() method.
 
Registration Process:
 
1) Log in to Twitter Developer Site [https://dev.twitter.com/apps/new] with your regular Twitter username and password.
 
2) Create a new Twitter application. Few problems I faced during the registration: a)The website URL has to start with http:// b)You don't need to specify Callback URL. If you do any POST actions, you must set access to Read & Write.
 
3)Write down the below credentials Twitter just created for your application (you'll need them later on): Consumer key Consumer secret
 
4)At the end of the page there is a button - "Create my Access Token" , 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 to the "OAuth tool" tab on the same page and all your app's credentials will be listed and are to be kept confidential.
 
5)Now back to our sources:
 
In twitter_functions.py, modify the call twitter.Api() to below:
 
twitter.Api(consumer_key = '<Consumer key generated above>',
consumer_secret = '<Consumer secret generated above>',
access_token_key = '<Access token key generated above>',
access_token_secret = '<Access token secret generated above>')
 
Now you should be able to successfully run:
 
python twitter_api.py --search=Python
 
and see some tweets containing the word "Python" :)
 
I am yet to familiarise myself with the bug tracking system used here @ OpenHatch. So till I can do that, hope this helps.
 
Cheers
--[[User:Divya KV|Divya KV]] ([[User talk:Divya KV|talk]]) 15:49, 7 August 2013 (UTC)
Anonymous user