Skip to content

Instantly share code, notes, and snippets.

@simonw
Created May 22, 2009 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonw/115985 to your computer and use it in GitHub Desktop.
Save simonw/115985 to your computer and use it in GitHub Desktop.
# Code for using http://developer.yahoo.com/geo/placemaker/
import urllib, httplib2
h = httplib2.Http()
URL = 'http://wherein.yahooapis.com/v1/document'
API_KEY = 'your-Yahoo-API-key'
def placemaker(text, doctype='text/plain'):
head, response = h.request(URL, 'POST', headers={
'Content-type': 'application/x-www-form-urlencoded'
}, body = urllib.urlencode({
'documentContent': text,
'documentType': doctype,
'appid': API_KEY
}))
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment