密码转换器汇率api的简单包装。
cryptonator的Python项目详细描述
一个简单的包装 Cryptonator汇率api。
安装
您可以使用pip安装cryptonator,或者只需复制 cryptonator.py项目根目录中的文件。
$ pip install cryptonator # add --user if you want
用法
importcryptonator"""Get an exchange rate between two currencies."""cryptonator.get_exchange_rate('usd','eur')# 0.95147479"""A Cryptonator API object can speed-up things if you need multiple calls."""api=cryptonator.Cryptonator()"""Get an exchange rate between a single curreny and many targets."""api.get_exchange_rates('usd',['eur','btc','xrp'])# {'btc': 0.00136076, 'eur': 0.95147479, 'xrp': 144.71780029}
测试
测试可以在test_cryptonator.py中找到。您可以使用以下命令启动它们:
$ python test_cryptonator.py