Issue 1 in ogmaps: Doesn't work from outside of US

0 views
Skip to first unread message

codesite...@google.com

unread,
Jun 3, 2008, 7:52:17 AM6/3/08
to ogmaps-...@googlegroups.com
Issue 1: Doesn't work from outside of US
http://code.google.com/p/ogmaps/issues/detail?id=1

Comment #4 by jake.turner:
This is because the URL is incomplete, it's relative, not absolute.

Modify the download method as follows:

def download_if_dne(href, filename):
if os.path.isfile(filename):
# print 'already downloaded:', href
return False
else:
if not href.startswith('http://'):
href = 'http://maps.google.com' + href
print 'Fixed url :', href
try:
print 'downloading:', href
oa = openanything.fetch(href)
if oa['status']==200:
file = open( filename, 'w' )
file.write( oa['data'] )
file.close()
return True
except KeyboardInterrupt:
raise
except:
print '\tdownload failed -', sys.exc_info()[0]
return False


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply all
Reply to author
Forward
0 new messages