python - Uber python API 在乘车请求时返回状态 409

标签 python uber-api

我正在按照 GitHub 项目页面上的说明进行操作
这一切都在沙盒模式

中运行

我先打电话

estimate = client.estimate_ride(
  product_id=product_id,
  start_latitude=start_lat,
  start_longitude=start_long,
  end_latitude=end_lat,
  end_longitude=end_long,
  seat_count=seat_count
)

然后返回类似

的东西
{
"pickup_estimate": 2,
"trip": {
    "distance_estimate": 2.18,
    "distance_unit": "mile",
    "duration_estimate": 240
},
"fare": {
    "fare_id": "14f81e7421f0ae124c2e5a97d0b9cf975cbb84fdd2bf6fc8b7bb2f49fc6c6f8a",
    "value": 8.06,
    "display": "$8.06",
    "currency_code": "USD",
    "expires_at": 1489104865
}

然后我使用上面获得的相同 product_id 和 fare_id(使用具有相同凭据的客户端对象)运行它

response = client.request_ride(
      product_id=product_id,
      start_latitude=start_lat,
      start_longitude=start_long,
      end_latitude=end_lat,
      end_longitude=end_long,
      seat_count=seat_count,
      fare_id=fare_id
  )

我得到的只是状态为 409 的 ClientError 异常。
知道出了什么问题吗?

最佳答案

409 错误很可能是由于您已经在该用户的沙盒中进行了一次旅行。您可以使用 client.get_current_ride_details() 检查并使用 client.cancel_current_ride() 取消正在进行的行程。

关于python - Uber python API 在乘车请求时返回状态 409,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42726052/

相关文章:

python - 单例 python 生成器?或者,pickle 一个 python 生成器?

android - 优步如何向司机发送新的乘车请求?

java - jackson 与 JSON : receiving "null" object

android - 下车位置昵称未显示在 Uber Android 应用程序上

python和pygame射击

python - 重构嵌套的 python 列表

python - 在 Flask 蓝图之间共享表单

python - Pytest 和 Faker |在每次测试中使用相同的数据

ios - 使用 Uber sdk iOS 显示实时出租车运动

ios - 从我的应用程序获取坐标到 Uber(ios、swift4)