Skip to main content

A Python API wrapper for the Atto node API.

Project description

ReadTheDocs Project generated with PyScaffold

atto.py

A Python API wrapper for the Atto node API.

An instance of AttoClient() represents a connection to an Atto node. Communication with the node happens through AttoClient()’s members.

The methods wrap the information from API responses in the form of Python builtins and classes in this module, such as:

  • Account

  • Entry

  • Receivable

  • Transaction

  • Block

Typical usage example:

from attopy import AttoClient, address_to_key

ADDRESS = '<your_address>'.removeprefix('atto://')

with AttoClient() as node:
    public_key = address_to_key(ADDRESS)
    account = node.get_account(public_key)
    print(f'balance: {account.balance}')

    # print first 100 transactions
    print('Hash\\tAmount')
    for entry in node.entries_stream(account, from_height=1, to_height=10, timeout=None):
        print(f'{entry.hash_[0:4]}...\\t{entry.amount}')

Example output:

balance: 1349500000
hash        Amount
A5DF...     10000000
BEEF...     49000000000
DEAD...     2500000000
... 97 more lines ...

Installation

Simply run pip install atto.py.

What’s missing?

AttoClient() is a synchronous client, meaning that all calls are blocking. Generators that access endpoints that stream indefinitely (such as the endpoint to scan for new entries) therefore should not be iterated over using for without a timeout, as they will never end and cannot be interrupted without user intervention.

An asynchronous client, AttoClientAsync(), is in the works. This client would facilitate near-instant updating of UI elements representing balances and lists of new entries, and would be able to wait for transactions to be confirmed, all without blocking the main thread.

Currently, AttoClient() supports some of the GET methods provided by the node API, and none of the POST methods. This means that AttoClient() can only query nodes, and can’t post transactions. This will change once a testing framework has been set up.

All classes and members should be fully documented soon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atto_py-0.1.1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atto_py-0.1.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file atto_py-0.1.1.tar.gz.

File metadata

  • Download URL: atto_py-0.1.1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for atto_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 88e55b60d40fcd06349fa5e4d54b1dcf6b7d012c54c38fc93e8af2a7d7c59640
MD5 6d916f5e6c186d19b6fc994d536503e3
BLAKE2b-256 1c0532c283c018a5f9336d6e05bb5380772055bed81010560cd68210c3a50c2e

See more details on using hashes here.

File details

Details for the file atto_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: atto_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for atto_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fcd9be0a4c119577fea3727b441403b6d37e2cb583e88665db496bd2b4de984
MD5 8bc3810fd176e075b83c4b0c64dd8e62
BLAKE2b-256 40a18457f95c112d340715c78b5bddc084f80bd56492819f33a5de6e44496fce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page