Skip to content

Commit 71a6e73

Browse files
authored
Using_the_GeoJSON_API
1 parent aee1a05 commit 71a6e73

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import urllib.request, urllib.parse, urllib.error
2+
import json
3+
4+
serviceurl = 'http://py4e-data.dr-chuck.net/json?key=42&'
5+
6+
address = input("Enter location: ")
7+
#address = "University of Mumbai"
8+
9+
url = serviceurl + urllib.parse.urlencode({"sensor":"false",'address': address})
10+
11+
print("Reteriving",url)
12+
uh = urllib.request.urlopen(url)
13+
data = uh.read().decode()
14+
print("Reteriving", len(data),"Characters")
15+
#print(data)
16+
17+
js = json.loads(data)
18+
#print(js)
19+
20+
placeid = js["results"][0]['place_id']
21+
print("Place id", placeid)

0 commit comments

Comments
 (0)