umlauts

Neil Hodgson nyamatongwe+thunder at gmail.com
Sat Oct 17 17:43:01 EDT 2009


   The server is sniffing the User-Agent header to decide whether to
send UTF-8 or ISO-8859-1. Try this code:

import urllib2
r = urllib2.Request("http://www.google.de/ig/api?weather=Muenchen",
	None, {"User-Agent":"Mozilla/5.0"})
f = urllib2.urlopen(r)
i = f.info()
print(i)
xml = f.read()
f.close()
print(xml)

   Neil



More information about the Python-list mailing list