def get_region_polygon():
with lock:
latitude = request.args.get('lat')
print latitude
longitude = request.args.get('lon')
print longitude
r = requests.get(lookupaddr+'/region?lat='+str(latitude)+'&lon='+str(longitude))
publishregion = r.content
print publishregion
publishregion = json.loads(publishregion)
app.logger.debug("Region of publisher: " + str(publishregion))
# print publishregion
# print type(publishregion)
# print publishregion['name']
sid = str(request.headers.get('sid'))
interest_list = client_dict[sid].keys()
for interest in interest_list:
regions = client_dict[sid][interest].keys()
new_region_exists = False
for region in regions:
if region == publishregion['name']:
new_region_exists = True
client_dict[sid][interest][region][0] = True
else:
client_dict[sid][interest][region][0] = False
if not new_region_exists:
client_dict[sid][interest][publishregion['name']] = [True, 0]
print client_dict
return str(publishregion['polygon'])
评论列表
文章目录