def getloc():
allloc = []
u"""??????api???????????
http://lbs.amap.com/api/webservice/guide/api/search/#text
"""
with ThreadPoolExecutor(max_workers=5) as executor:
url = 'http://lbs.amap.com/api/webservice/guide/api/search/#text'
param = {
'key': '22d6f93f929728c10ed86258653ae14a',
'keywords': u'??',
'city': '027',
'citylimit': 'true',
'output': 'json',
'page': '',
}
future_to_url = {executor.submit(load_url, url, merge_dicts(param, {'page': i}), 60): url for i in range(1, 46)}
for future in futures.as_completed(future_to_url):
if future.exception() is not None:
print(future.exception())
elif future.done():
data = future.result()['pois']
allloc.extend([x['location'] for x in data])
with open('allloc1.pk', 'wb') as f:
pickle.dump(allloc, f, True)
评论列表
文章目录