Skip to content

Commit f3924db

Browse files
committed
google places API is really fucked up...and Flipkart's server is down.
1 parent a528481 commit f3924db

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

app/views.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ def food_restaurant():
177177
lat = i['geometry']['location']['lat'],
178178
lng = i['geometry']['location']['lng']
179179
)
180+
try:
181+
d['rating'] = i['rating']
182+
except:
183+
d['rating'] = '0.0'
184+
185+
try:
186+
d['open_now'] = i['opening_hours']['open_now']
187+
except:
188+
d['open_now'] = 'no response'
180189
arr.append(copy.deepcopy(d))
181190

182191
return json.dumps(arr)
@@ -203,6 +212,15 @@ def food_bar():
203212
lat = i['geometry']['location']['lat'],
204213
lng = i['geometry']['location']['lng']
205214
)
215+
try:
216+
d['rating'] = i['rating']
217+
except:
218+
d['rating'] = '0.0'
219+
220+
try:
221+
d['open_now'] = i['opening_hours']['open_now']
222+
except:
223+
d['open_now'] = 'no response'
206224
arr.append(copy.deepcopy(d))
207225

208226
return json.dumps(arr)
@@ -257,6 +275,14 @@ def food_cafe():
257275
lat = i['geometry']['location']['lat'],
258276
lng = i['geometry']['location']['lng']
259277
)
278+
try:
279+
d['rating'] = i['rating']
280+
except:
281+
d['rating'] = '0.0'
282+
try:
283+
d['open_now'] = i['opening_hours']['open_now']
284+
except:
285+
d['open_now'] = 'no response'
260286
arr.append(copy.deepcopy(d))
261287

262288
return json.dumps(arr)

0 commit comments

Comments
 (0)