加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
scratch_airport_name.py 776 Bytes
一键复制 编辑 原始数据 按行查看 历史
# -*- coding: UTF-8 -*-
import requests
import bs4
import json
import Handle
resources_file_path = '/airportNameList.txt'
scratch_url = 'https://data.variflight.com/profiles/profilesapi/search'
def scratch_airport_name(scratch_url, old_airports):
new_airports = []
data = requests.get(scratch_url).text
all_airport_json = json.loads(data)['data']['list']
for airport_by_word in all_airport_json.values():
for airport in airport_by_word:
if airport['profiles_city'] and airport['profiles_name'] not in old_airports:
new_airports.append(airport['profiles_city'] + ',' + airport['profiles_name'])
return new_airports
if __name__ == '__main__':
Handle.handle(resources_file_path, scratch_url, scratch_airport_name)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化