Showing posts with label gdata. Show all posts
Showing posts with label gdata. Show all posts

OAuth in Google App Engine


This sample demonstrates a basic structure that you can use to perform 3-legged OAuth using the Google Data Python client library in Google App Engine. This particular example talks to the Documents List Data API.

App Engine (Python) + OAuth sample

Note: The sample is available in two versions, one that signs requests with RSA-SHA1 and another that signs with HMAC-SHA1.

Performing a GET with a POST using a Data API


Sometimes you can only do a GET when you need to do a DELETE, since some systems don't support all of the HTTP verbs. Also since Flash doesn't let you set a custom Authorization header on a GET, sometimes you need to do a GET with a POST. How can you do this? With the X-HTTP-Method-Override header:
X-HTTP-Method-Override: GET
For example, say you want to perform a video search in YouTube using a POST request:
POST /feeds/api/videos HTTP/1.1
Host: gdata.youtube.com
X-HTTP-Method-Override: GET
Content-Length: 23
Content-Type: application/x-www-form-urlencoded

vq=kitten&max-results=1
This is the same as performing a GET on http://gdata.youtube.com/feeds/api/videos?vq=kitten&max-results=1 The POST body is used as the set of query parameters. You can also do this using the curl command:
curl -H "X-HTTP-Method-Override: GET" -X POST http://gdata.youtube.com/feeds/api/videos -d "vq=kitten&max-results=1"