定期收集uber票价的简单工具。
uberfare的Python项目详细描述
这是官方uber python sdk的一个简单包装,旨在 从指定位置的给定origin和destination收集数据 时间间隔。
当前实现只处理价格估计功能,因为 它不需要OAuth 2.0访问。
动机
我用这个工具来收集数据然后评估 最好是离开家去订一辆Uber车去上班,然后 反之亦然。
要求
- Python3.4+
API键
通过在以下位置创建应用程序来获取Server Tokenapi密钥: developer.uber.com/dashboard, 然后:
- 创建或选择应用程序
- 复制auth页中的server标记值
在使用此包之前,请将Server Token导出为: export UBER_SERVER_TOKEN=<Server Token>。但是,您可以覆盖 在使用cli时(请参见下文)。
用法
你必须确定你所在位置的(latitude,longitude), 因为可用的乘车类型将取决于它。
得到坐标的最好方法是 maps.google.com然后单击 地图上的任何一点。一个小盒子将出现在底部中心 包含经度和纬度的屏幕。注意 起点和终点的坐标:
cli
>>> # To get the fare estimate, provide the arguments: <origin>, <destination> >>> # (Where origin and destination are in the <LATITUDE,LONGITUDE> format) >>> uberfare estimate 14.55,121.05 14.52,121.01 >>> # To save all the RAW data in a CSV file, you can do: >>> uberfare estimate 14.55,121.05 14.52,121.01 --output-file output.csv
>>> # You can also periodically fetch the Uber fares by using the >>> # --check-interval <time in seconds> flag (short -ci): >>> uberfare --check-interval 120 estimate 14.55,121.05 14.52,121.01 >>> uberfare -ci 120 estimate 14.55,121.05 14.52,121.01 >>> # To safely save the data in long periods of time, do: >>> uberfare --check-interval 120 estimate 14.55,121.05 14.52,121.01 --output-file output.csv >>> # You can override the '$UBER_SERVER_TOKEN' env variable right in the CLI via: >>> uberfare --server_token <SERVER API KEY> estimate 14.55,121.05 14.52,121.01 >>> uberfare -st <SERVER API KEY> estimate 14.55,121.05 14.52,121.01
注释
在指定一个非常短的时间间隔来检查 因为你们的价格可能是有限制的。
未来版本
- 作为包导入的更好界面
- 使用地址而不是坐标的选项(使用 Google Maps Geocoding API)
- 通过启用OAuth2支持前期票价数据收集。