Skip to content

Latest commit

 

History

History
15 lines (14 loc) · 474 Bytes

EN18CS301169PradeepLowanshi.md

File metadata and controls

15 lines (14 loc) · 474 Bytes

#Hello #This is the Api code to get location. import urllib.error, urllib.request, urllib.parse import json #give the target api url to open target = '' local = input('Enter location: ') url = target + urllib.parse.urlencode({'address': local, 'key' : 42})

print('Retriving', url) data = urllib.request.urlopen(url).read() print('Retrived', len(data), 'characters') js = json.loads(data) print(json.dumps(js, indent = 4)) print('Place id', js['results'][0]['place_id'])