mobai.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:mobike 作者: wangshulingxiao 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号