2

requests沙盒中的Uber apis端点给出的响应如下:

u'<html><title>404: Not Found</title><body>404: Not Found</body></html>'.

对于沙箱,我使用的是端点:

https://sandbox-api.uber.com/v1/sandbox/requests

如果我使用 uber prod 端点,相同的请求可以正常工作

https://api.uber.com/v1/requests

我使用 python 请求库作为 api:

import request

params = {'start_longitude': 'xx.xxxxxx', 'end_longitude': 'xx.xxxxxx', 
          'start_latitude': 'xx.xxxxxx', 'end_latitude': 'xx.xxxxxx', 
          'product_id': '0dfc35e0-b4be-49a1-b1bf-0bc7217e4b58'}
header = {'Content-Type': 'application/json', 
          'Authorization': 'Bearer xxx-acces-token-xxx'`}

res = requests.post('https://sandbox-api.uber.com/v1/sandbox/requests',
                     data=json.dumps(params), headers=headers)

就像我说的那样,如果我将 url 更改为 uber prod 环境,这项工作:

 res = requests.post('https://api.uber.com/v1/requests',
                      data=json.dumps(params), headers=headers)
4

1 回答 1

3

uber api 的沙盒 url 是:- https://sandbox-api.uber.com/v1/requests

于 2015-04-15T06:35:12.707 回答