etherscan.io api的非正式包装
pyetherscan的Python项目详细描述
……图片::https://travis-ci.org/marto32/pyeterscan.svg?branch=master
:目标:https://travis ci.org/marto32/pyeterscan
…图片::https://workalls.io/repos/github/marto32/pyeterscan/badge.svg?branch=master
:目标:https://coveralls.io/github/marto32/pyetherscan?分支=主
…图片::https://img.shields.io/pypi/pyversions/pyethscan.svg
:目标:https://pypi.python.org/pypi/pyethscan
…图片::https://img.shields.io/pypi/v/pyethscan.svg
:目标:https://pypi.python.org/pypi/pyethscan
pyethscan
==
ethscan的非正式包装<;https://ethscan.io>;` api.
安装
===
我们建议您在新的“虚拟环境”中安装此库,lt;http://python guide pt br.readthedocs.io/en/latest/dev/virtualenvs/>;` ` `.
若要安装,请创建新的“etherscan帐户”<;https://etherscan.io>;` ` ` ` ` ` ` ` `,并记下您的api密钥。然后运行以下命令安装库:
…代码块::python
安装后,设置api密钥有两种主要方法。第一个
是通过创建名为`.pyeterscan.ini``的配置文件并将其保存在主目录中。此文件的格式如下:
…代码块:none
[凭据]
etherscan-api-key:yourapikeytoken
第二个是通过设置环境变量“etherscan-api-key”`.
图书馆的使用方法。第一种是通过“client”对象与“etherscan api”直接交互,https://etherscan.io/api>;` `.
。代码块::python
in[1]:从pyethscan导入客户机
in[2]:client=client()
in[3]:address='0xde0b295669fd93d5f28d9ec85e40f4cb697bae'
in[4]:address_balance=client.get_single_balance(address)
in[5]:address_balance.response_status_code
out[5]:200
in[6]:address_balance.message
out[6]:'ok'
in[7]:address_balance.balance
out[7]:748997604382925139479303
第二个是使用完全抽象api的“pyetrscan”对象。这些
对象可以在``pyeterscan.ethereum``模块中找到,包括:
-``transaction``
-``address`
-``block`
-``token`
,例如:
。代码块::python
in[1]:从pyetherscan导入地址
in[2]:地址='0xde0b295669fd93d5f28d9ec85e40f4cb697bae'
in[3]:以太坊地址=地址(地址)
in[4]:以太坊地址。balance
out[4]:7489976043829251394793303.0
in[4]:用于txn in以太坊地址。事务:
…:打印(txn.value)
图片::https://badges.gitter.im/pyethscan/lobby.svg
:alt:加入聊天,网址是https://gitter.im/pyethscan/lobby
:target:https://gitter.im/pyethscan/lobby?联合技术手册来源=徽章和联合技术手册媒介=徽章和联合技术手册活动=公关徽章和联合技术手册内容=徽章
:目标:https://travis ci.org/marto32/pyeterscan
…图片::https://workalls.io/repos/github/marto32/pyeterscan/badge.svg?branch=master
:目标:https://coveralls.io/github/marto32/pyetherscan?分支=主
…图片::https://img.shields.io/pypi/pyversions/pyethscan.svg
:目标:https://pypi.python.org/pypi/pyethscan
…图片::https://img.shields.io/pypi/v/pyethscan.svg
:目标:https://pypi.python.org/pypi/pyethscan
pyethscan
==
ethscan的非正式包装<;https://ethscan.io>;` api.
安装
===
我们建议您在新的“虚拟环境”中安装此库,lt;http://python guide pt br.readthedocs.io/en/latest/dev/virtualenvs/>;` ` `.
若要安装,请创建新的“etherscan帐户”<;https://etherscan.io>;` ` ` ` ` ` ` ` `,并记下您的api密钥。然后运行以下命令安装库:
…代码块::python
安装后,设置api密钥有两种主要方法。第一个
是通过创建名为`.pyeterscan.ini``的配置文件并将其保存在主目录中。此文件的格式如下:
…代码块:none
[凭据]
etherscan-api-key:yourapikeytoken
第二个是通过设置环境变量“etherscan-api-key”`.
图书馆的使用方法。第一种是通过“client”对象与“etherscan api”直接交互,https://etherscan.io/api>;` `.
。代码块::python
in[1]:从pyethscan导入客户机
in[2]:client=client()
in[3]:address='0xde0b295669fd93d5f28d9ec85e40f4cb697bae'
in[4]:address_balance=client.get_single_balance(address)
in[5]:address_balance.response_status_code
out[5]:200
in[6]:address_balance.message
out[6]:'ok'
in[7]:address_balance.balance
out[7]:748997604382925139479303
第二个是使用完全抽象api的“pyetrscan”对象。这些
对象可以在``pyeterscan.ethereum``模块中找到,包括:
-``transaction``
-``address`
-``block`
-``token`
,例如:
。代码块::python
in[1]:从pyetherscan导入地址
in[2]:地址='0xde0b295669fd93d5f28d9ec85e40f4cb697bae'
in[3]:以太坊地址=地址(地址)
in[4]:以太坊地址。balance
out[4]:7489976043829251394793303.0
in[4]:用于txn in以太坊地址。事务:
…:打印(txn.value)
图片::https://badges.gitter.im/pyethscan/lobby.svg
:alt:加入聊天,网址是https://gitter.im/pyethscan/lobby
:target:https://gitter.im/pyethscan/lobby?联合技术手册来源=徽章和联合技术手册媒介=徽章和联合技术手册活动=公关徽章和联合技术手册内容=徽章