GithubHelp home page GithubHelp logo

py-eos-api's Introduction

Python EOS Api Client

This is an unofficial API wrapper by @furion

Installation

pip install -U git+https://github.com/Netherdrake/py-eos-api

Usage

>>> from eosapi import Client
>>> c = Client(nodes=['http://localhost:8888'])

>>> c.get_info()

    {'head_block_id': '0000652e92c1f73e14503383ee18c28901dd301ff5be0b94c77d846d799d5050',
     'head_block_num': 25902,
     'head_block_producer': 'initi',
     'head_block_time': '2017-09-16T04:25:18',
     'last_irreversible_block_num': 25884,
     'participation_rate': '1.00000000000000000',
     'recent_slots': '1111111111111111111111111111111111111111111111111111111111111111'}

>>> c.get_account?

    Signature: c.get_account(name) -> dict
    Docstring: Fetch a blockchain account
    File:      ~/GitHub/EOS/py-eos-api/eosapi/api.py
    Type:      method

>>> c.get_account('inita')

    {'eos_balance': '1000000.0000 EOS',
     'last_unstaking_time': '1969-12-31T23:59:59',
     'name': 'inita',
     'permissions': [{'name': 'active',
       'parent': 'owner',
       'required_auth': {'accounts': [],
        'keys': [{'key': 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV',
          'weight': 1}],
        'threshold': 1}},
      {'name': 'owner',
       'parent': 'owner',
       'required_auth': {'accounts': [],
        'keys': [{'key': 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV',
          'weight': 1}],
        'threshold': 1}}],
     'staked_balance': '0.0000 EOS',
     'unstaking_balance': '0.0000 EOS'}

You can also use a lower level HttpClient directly:

from eosapi import HttpClient

h = HttpClient(["http://localhost:8888"])

print(h.exec('chain', 'get_block', '{"block_num_or_id": 5}'))
print(h.exec('chain', 'get_block', {"block_num_or_id": 5}))
print(h.exec('chain', 'get_info'))

You can also stream raw blocks (polling indefinitely):

from eosapi import Client
c = Client()

for block in c.stream_blocks(start_block=100, mode='head'):
    print(block)

TODO

  • add support for type hints (Union[NativeType, PythonType])
  • split api into submodules to avoid potential collisions
  • apigen: load from json spec files once they are finalized

License

MIT

py-eos-api's People

Contributors

avral avatar netherdrake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-eos-api's Issues

Is this ready to be used

how easy it is to use in python code as i did not see any pip install option in your writeup. Thnx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.