20 June 2008
Google's documentation for the appengine is a bit basic for those not to familiar with Python, like me.
If your building a mashup, your going to want to use the fetch routine to pull down data from a web service. This is one of those vaguely documented features.
Here is how it's done.
import base64
from google.appengine.api import urlfetch
url = "www.target_webservice.com"
username = "your_username"
password = "your_password"
base64string = base64.encodestring('%s:%s' % (username, password))
headers = {'Authorization': "Basic %s" % base64string}
result = urlfetch.fetch(url, headers=headers)
if result.status_code == 200:
all is good
else:
something went wrong

Trackback URL