使用此帖子请求创建交付时遇到一些问题:
{'dropoff_name': 'stephen',
'pickup_address': '1234 Bancroft Way, Emeryville, CA',
'pickup_phone_number': '1231231234',
'dropoff_phone_number': '1231231234',
'dropoff_address': '200 Powell Street, Emeryville, CA',
'pickup_name': 'ShareTea',
'manifest': 'boba'
}
这是我的代码:
def post_data(self):
post_data = {}
post_data["manifest"] = self.manifest
# post_data['manifest_items'] = self.manifest_items
post_data.update(self.pickup.post_data("pickup"))
post_data.update(self.dropoff.post_data("dropoff"))
if self.quote:
post_data["quote_id"] = self.quote.quote_id
return post_data
def _make_request(self, url, data=None, type='get'):
if type == 'post':
print(data)
headers = {'Content-type': 'application/x-www-form-urlencoded'}
response = requests.post(url, data=data, auth=(self.api_key, ''), headers = headers)
params = delivery.post_data()
return self._make_request(url, data=params, type='post')
我收到一个 400 异常,提示您请求的参数无效。