简体   繁体   中英

Twitter Search API authentication

I had an application running on GAE which accessed twitter Search API. However recently twitter has moved to the new version 1.1 and previous version of api is no longer functional. And I'm having trouble accessing the new API.

Basically I wanted to get tweets matching a search query and I simply accessed the url using python code and got all the data in json format. The url I accessed (which is not working now) is: http://search.twitter.com/search.json?q=query

Instead I searched and found out that the equivalent url in new API is probably: https://api.twitter.com/1.1/search/tweets.json?q=query

However if I just access it simply like I did before (just fetching the url and accessing the contents) then it gives an error and apparently I need to authenticate my request by obtaining some oauth credentials and using them with the request.

I tried searching of how to do that if there is another method beside just fetcihng the url contents, but in vain. I'd really appreciate if someone could help me out, and if possible give some sample python code. Thanks!

New Twitter API needs user authentication, meaning that each user visiting your site will need to go through auth procedure. This makes new Twitter API much less useable.

See this answer for details how to use OAuth on GAE/Python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM