-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson_breakdown.py
More file actions
68 lines (58 loc) · 2 KB
/
Copy pathjson_breakdown.py
File metadata and controls
68 lines (58 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
''' Code to use in python tutor to quickly indicise json payload for extracting data.
Usage
Copy and paste in python tutor
Edit json
run the code
'''
def venues(cords):
output = []
for j in range(len(cords)):
result = {'meta': {'code': 200, 'requestId': '5d84ce676adbf5002c058857'},
'response': {'confident': True,
'venues': [{'categories': [{'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/building/gym_',
'suffix': '.png'},
'id': '4bf58dd8d48988d175941735',
'name': 'Gym / Fitness Center',
'pluralName': 'Gyms or Fitness Centers',
'primary': True,
'shortName': 'Gym / Fitness'}],
'hasPerk': False,
'id': '4afff888f964a520623a22e3',
'location': {'address': '333 Goswell Road',
'cc': 'GB',
'city': 'London',
'country': 'United Kingdom',
'distance': 36,
'formattedAddress': ['333 Goswell Road',
'London',
'Greater London',
'EC1V 7DG',
'United Kingdom'],
'labeledLatLngs': [{'label': 'display',
'lat': 51.5313435,
'lng': -0.1051354}],
'lat': 51.5313435,
'lng': -0.1051354,
'postalCode': 'EC1V 7DG',
'state': 'Greater London'},
'name': 'Virgin Active',
'referralId': 'v-1568984679'}]}}
try:
output.append([cords[j][0],
cords[j][1],
cords[j][2],
result['response']['venues'][0]['name'],
'Yes'])
except:
output.append([cords[j][0],
cords[j][1],
cords[j][2],
'No result',
'No'])
# print(f'{cords[j][0]} has no venue')
outputA = output
return outputA
latlongs = [['E1 0Ad', 51.51291, -0.055323000000000004],
['E1 0As', 51.511571999999994, -0.052685],
['E1 0Bw', 51.510758, -0.05676900000000001]]
ans = venues(latlongs)