I want to use Hunch on Google App Engine in Python. What libraries do I need to use to do this or are there any good online tutorials that could help me with this?
I would start from the API Overview documentation of the official site.
Basically Hunch API calls are authenticated GET or POST HTTP requests where the returned values are JSON encoded.
Example:
get the list of the top recommended movies:
http://api.hunch.com/api/v1/get-recommendations/?topic_ids=all_544&limit=10
get-recommendation is just one of the many available routes that Hunch API offers; to get an overview of all the available methods, have fun playing with the API console.
On google App Engine you would need:
UrlFetch API to make the HTTP Api calls
simplejson to decode the results
Here are a couple of Hunch GAE projects that should help you to get started:
hunch-gift-app
hunch-sample-app
As referenced by gleitz, you can find a Python wrapper here.
Recently, mnn2104 wrote a Python wrapper for the Hunch API called HunchPY.
As for tutorials, a good place to start is the the Hunch Developer homepage and Hunch's Github profile.
Related
We use Google Apps at my organization. I am trying to just use my API key (no oauth2) to get access to users info through the Directory API in the Admin SDK. I cannot find useful examples and the Google docs are buggy. I have had a great deal of difficulty with Google's API documentation. Or perhaps I have to use oauth2?
Even if I knew some of the details about this specific API, I can't find sample code for using these APIs in Python. Does anyone have sample code or links to real-world samples? I am new to Python and we're working on the App Engine.
You must use OAuth2 authentication, API key alone is not enough as you must authenticate as a Google Apps super admin or delegated admin (with appropriate rights) in order to perform Admin SDK Directory operations.
My project, Dito GAM was recently updated with full support for Admin SDK calls. It makes use of most (all?) Directory API calls. See:
https://code.google.com/p/google-apps-manager/source/browse/trunk/gam.py
Also, if you notice bugs or ambiguities in the Google documentation, be sure to report them. It won't get any better if someone doesn't tell them about it! Use the "Report a bug" link at the bottom of all developers.google.com pages. It's very simple to use and pinpoint the exact issue.
I'd like to allow my Google App Engine application to connect to a clients Google Spreadsheet on their Google Drive. I've spent the last two and a half days trying, and I've gotten nowhere. Half of the GAE Python documentation seems to be out of date. For example some of the examples have webapp, and they don't work until I change them to webapp2, but that doesn't always work.
I created a OAuth2.0 thing (not really sure what to call it) at:
https://code.google.com/apis/console/
So now I have a Client ID and Client Secret, but one doc talked about a CONSUMER_KEY and CONSUMER_SECRET. So are they the same or?
I followed the following doc to use OAuth to read my tasks (I know it's a different API), but I couldn't figure out step/Task 3. I'm not sure if I have all of the files/librarys to connect using OAuth. I have the gdata-2.0.17 files, and I know how to connect to the drive and spreadsheets by hard coding the login credentials, but no user is going to give me their credentials.
I don't normally ask for code, or even help, but I'm completely lost with this whole OAuth API/Service.
If someone could post some sample code that uses OAuth 2.0 and webapp2, and that you have tested, that would be awesome.
If someone could link me to a sample GAE Python project that can authenticate with Google's servers and allow it to connect to the users spreadsheets using OAuth 2.0 and webapp2, I'd be over the moon.
A complete example application using Google Drive from GAE is explained in this article.
See Retrieving Authenticated Google Data Feeds with Google App Engine (Python) if you need to access the spreadsheet content.
The samples in this article is using Google Document List API but it could be easily adapted to use spreadsheets scope and spreadsheet client or service.
If you only need to list the files, I would recommend using Drive like #SebastionKreft suggested
I want to write a desktop python app using google drive API but the documentation on google website is a little messy and twisted with drive sdk which makes thing complicated and difficult to find useful staffs.
Can anyone give some useful doc and some sample code?
Thx~
When using Twisted, you will need to adopt a policy whereby every Drive API call is deferred to a thread or threadPool. I recently wrote a blog post about it here:
http://unpythonic.blogspot.com/2012/07/calling-google-drive-api-and-other.html
I am trying to implement Google Authentication in my website, in which I would also be pulling some Google Data using the Google Data API and I am using Google App Engine with Jinja2.
My question is, so many ways are mentioned to do it. I am confused between Google Federated Login,Google Data Protocol, Hybrid Protocol. Are these things the same or different ways to do the same thing.
From what I read and understood, which might be incorrect, Google Federated Login uses the hybrid protocol to authenticate and fetch the google data.
Is there a proper guide to implement any one of these in python. Examples which I found at the google link are kind of different. From what I understood,correct me if i am wrong, I have to implement only the OpenID Consumer part.
In order to implement Google Federated Login in Python, I saw that we need to download a separate library from the openid-enabled.com but I found a different library for the google data implementation at http://code.google.com/p/gdata-python-client/
As you can see, I am confused a lot :D. Please help me :)
Thanks
Here is an article specifically on Retrieving Authenticated Google Data Feeds with Google App Engine
The way I understand this example:
You use the gdata-python-client to set up this AuthSub interaction
gdata.auth.extract_auth_sub_token_from_url extracts the token you get from AuthSub (step 4 above)
you can now use this token to access Google Data.
I have a requirement to build a client for Shopify's API, building it in Python & Django.
I've never done it before and so I'm wondering if someone might advise on a good starting point for the kinds of patterns and techniques needed to get a job like this done.
Here's a link to the Shopify API reference
Thanks.
Your question is somewhat open-ended, but if you're new to Python or API programming, then you should get a feel for how to do network programming in Python, using either the urllib2 or httplib modules that come with more recent versions of Python. Learn how to initiate a request for a page and read the response into a file.
Here is an overview of the httplib module in Python documentation:
http://docs.python.org/library/httplib.html
After you've managed to make page requests using the GET HTTP verb, learn about how to make POST requests and how to add headers, like Content-Type, to your request. When communicating with most APIs, you need to be able to send these.
The next step would be to get familiar with the XML standard and how XML documents are constructed. Then, play around with different XML libraries in Python. There are several, but I've always used xml.dom.minidom module. In order to talk to an API, you'll probably need to know to create XML documents (to include in your requests) and how to parse content out of them. (to make use of the API's responses) The minidom module allows a developer to do both of these. For your reference:
http://docs.python.org/library/xml.dom.minidom.html
Your final solution will likely put both of these together, where you create an XML document, submit it as content to the appropriate Shopify REST API URL, and then have your application deal with the XML response the API sends back to you.
If you're sending any sensitive data, be sure to use HTTPS over port 443, and NOT HTTP over port 80.
I have been working on a project for the last few months using Python and Django integrating with Shopify, built on Google App Engine.
Shopify has a valuable wiki resource, http://wiki.shopify.com/Using_the_shopify_python_api. This is what I used to get a good handle of the Shopify Python API that was mentioned, https://github.com/Shopify/shopify_python_api.
It will really depend on what you are building, but these are good resources to get you started. Also, understanding the Shopify API will help when using the Python API for Shopify.
Shopify has now released a Python API client: https://github.com/Shopify/shopify_python_api
I think you can find some inspiration by taking a look at this:
http://bitbucket.org/jespern/django-piston/wiki/Home
Although it is directly opposite what you want to do (Piston is for building APIs, and what you want is to use an API) it can give you some clues on common topics.
I could mention, of course, reading obvious sources like the Shopify developers forum:
http://forums.shopify.com/categories/9
But I guess you already had it in mind :)
Cheers,
H.