0

次のコードを実行してアドレス情報を取得し、urllib.urlopen() を使用して geo API に接続すると、IOError: [Errno socket error] [Errno 10060] が発生します。

また、Web ブラウザーから Json データをダウンロードできます。しかし、Python で URL を開くことはできません。

[1]import urllib
[2]import json
[3]serviceurl = 'http://maps.googleapis.com/maps/api/geocode/json?'
[4]address = raw_input('Enter location: ')
Enter location: South Federal University
[5]url = serviceurl + urllib.urlencode({'sensor':'false', 'address': address})
[6]print 'Retrieving', url
Retrieving http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=South+Federal+University
[7]uh = urllib.urlopen(url)
4

0 に答える 0