开放的汇率客户
boxr的Python项目详细描述
Boxr是一个更好的开放式汇率客户——至少比我好 能够找到,因为这个是维护的。
安装
$ pip install boxr
用法
boxr映射1:1,这里记录了oxr api: https://docs.openexchangerates.org/docs/。这意味着 https://openexchangerates.org/api/latest.json映射到boxr.latest(), 以及https://openexchangerates.org/api/historical/:date.json映射到 boxr.historical(date)。
简而言之
- 路由映射到函数名,例如/latest.json->;latest()
- 路径参数映射到函数参数,例如 /historical/:date.json->;historical(date)
- 查询参数映射到关键字参数,例如 /time-series.json?start=2017-01-01&end=2017-01-05->; time_series(start="2017-01-01",end='2017-01-05')
还要注意,所有端点都返回requestsresponse objects, 因此,请求的验证或响应的格式可以是 通过与响应对象交互完成。
示例用法
fromboxrimportBoxrboxr=Boxr(app_id='your_app_id')# All calls return a `requests` Response objectlatest=boxr.latest()# And thus we get the jsonresult=latest.json()
贡献
我希望这个包始终是最新的oxr http api。 如果有一天不是这样,请打开拉取请求或打开 关于不合规的问题。