Python请求后408 timeou

2024-04-18 07:01:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用批处理API在Python中对地址进行地理编码HERE.com网站(https://developer.here.com/api-explorer/rest/batch_geocoding/batch-geocode-addresses

url = 'https://batch.geocoder.api.here.com/6.2/jobs?app_id={APP_ID}&app_code={APP_CODE}&indelim=%7C&outdelim=%7C&action=run&outcols=displayLatitude%2CdisplayLongitude%2ClocationLabel&outputcombined=true'.format(APP_ID=appId, APP_CODE=appCode)

headers = {'content-type': 'text/plain', 'Accept-Charset': 'UTF-8'}

payload = open('payload_sm.txt')

r = requests.post(url, data=payload, headers=headers)

这给了我:

408请求超时

请求超时

服务器等待来自客户端的HTTP请求超时。你知道吗


我不确定txt文件的格式是否正确。从视觉上看,它看起来像是他们的示例输入。我想如果这是个问题的话,我会得到一个“400坏请求”。你知道吗


Tags: httpstxtcomapiidappurlhere