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.
Related
i am trying to use the requests library with python to fetch data from the traffic api with python.
this is the link for website with api that should include the traffic data:
https://api.tomtom.com/traffic/services/4/flowSegmentData/relative0/10/json?point=52.41072%2C4.84239&openLr=true&jsonp=jsonp&key=3EeqxQCR2DNsYzRCT0RPIxUhlzAM3hQc
but it returns an "Developer Inactive" on the website . how to solve that and use the api
also i want to ask if this will work with kivy.
API request that you provided has an API key that is not existing anymore. I tried it with your API key that you provided in the comment and it worked. But you must notice that you copied it wrongly - there is an additional character at the beginning.
I'm quite a novice, so please excuse my ignorance.
I've created a developer account on my personal Twitter account and my end goal is to have another account occasionally tweet something. I'm using tweepy and have successfully managed to tweet something, albeit from my account.
Twitter developer accounts can get their API key and secret, as well as an Access key and secret. What I'm trying to figure out is how to get my bot account's keys to have it tweet instead of my account.
After reading countless pages online as well as the docs, there seems to be a way to get auth another user through three-legged auth and pin-based auth, which seems like the correct route to my goal.
However, I have no idea where to go from here. The three-legged auth page asks for various required fields, of which I have no idea what to fill with (Callback URLs and Website URL). Moreover, the docs describe the process as one that needs to be initiated by the dev account, and I have no idea how to initiate that process at all.
Any help or guidance on what to do? My tweepy script is fully finished and just needs to be hooked up to the Twitter API.
Thanks.
EDIT & SOLUTION (03/18/2021):
Thanks to the comment by Sim leading to the article, I was able to derive a python script using Tweepy to authorize the bot using pin-based auth, found here. I'd give the article a read regardless, but once it starts telling you to create .js and .json files, stop there and use my script. That's what worked for me.
Found a solution that worked for me, I think this is what you need. https://dev.to/stratospher/many-bot-accounts-using-1-twitter-developer-account-17ff
I am doing a test project that uses Facebook Graph API to retrieve data from an events page. I need to use the following url: https://graph.facebook.com/OffTheGridSF/events and do a HTTP GET from my web app. I created a facebook app (for testing) and have the APP_ID, APP_SECRET. I was wondering which library (if any) should I use. I have looked at django-facebook and pyfb. I am not sure how the authentication process works. I don't need a login page for my website. I only need the JSON containing the list of events. Any help as to how I should proceed will be highly appreciated. I just started playing around with Django a few hours ago so nothing is trivial.
You can try using python requests library directly with the URL you want to GET. Checkout requests-oathlib
I am making a web application that will monitor the amount of members and discussions in each one of the groups listed here (http://www.codecademy.com/groups#web) and display that information in nice graphs.
However, as you have already seen, it looks like I need to create an account and login with it.
Having in mind that my project is using Python for the server side, how do I do it? Which API is easier? (Google, FB or twitter?)
I would really love if you could also provide some examples because I am really new at this (and at Python too).
The official wrapper around the Twitter API for Python is this one. I used it and it's very easy. You should first read this page and also register an application to get OAuth keys.
Example:
import twitter
# Remember to put these values
api = twitter.Api(consumer_key="",
consumer_secret="",
access_token_key="",
access_token_secret="")
# Get your timeline
print api.GetHomeTimeline()
Hope it helps.
Google provides APIs for a number of their services and bindings for several languages. However, not everything is supported. So this question comes from my incomplete understanding of things like wget, curl, and the various web programming libraries.
How can I authenticate programmatically to Google?
Is it possible to leverage the existing APIs to gain access to the unsupported parts of Google?
Once I have authenticated, how do I use that to access my restricted pages? It seems like the API could be used do the login and get a token, but I don't understand what I'm supposed to do next to fetch a restricted webpage.
Specifically, I am playing around with Android and want to write a script to grab my app usage stats from the Android Market once or twice a day so I can make pretty charts. My most likely target is python, but code in any language illustrating non-API use of Google's services would be helpful. Thanks folks.
You can get the auth tokens by authenticating a particular service against https://www.google.com/accounts/ClientLogin
E.g.
curl -d "Email=youremail" -d "Passwd=yourpassword" -d "service=blogger" "https://www.google.com/accounts/ClientLogin"
Then you can just pass the auth tokens and cookies along when accessing the service. You can use firebug or temper data firefox plugin to find out the parameter names etc.
You can use something like mechanize, or even urllib to achieve this sort of thing. As a tutorial, you can check out my article here about programmatically submitting a form .
Once you authenticate, you can use the cookie to access restricted pages.
CLientLogin is now deprecated: https://developers.google.com/accounts/docs/AuthForInstalledApps
How can we authenticate programmatically to Google with OAuth2?
I can't find an expample of request with user and password parameter as in the CLientLogin :(
is there a solution?