【发布时间】:2021-01-17 14:00:56
【问题描述】:
api_key = 无
base_url = 无
def 配置请求(应用程序): 全局 api_key,base_url api_key = app.config['IMAGE_API_KEY'] base_url = app.config['API_BASE_URL']
def get_image(类别):
get_image_url = base_url.format(api_key,category)
with urllib.request.urlopen(get_image_url) as url:
get_image_data = url.read()
get_image_response = json.loads(get_image_data)
image_results = None
image_results = process_results(get_image_response)
# print(image_results)
return image_results
【问题讨论】: