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.

Atto.py provides a Pythonic interface for communicating with Atto nodes, allowing developers to interact with the account-chain ledgers without dealing with low-level API details.

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 = '<your_address>'

with AttoClient('http://h:8080') as node:
    print('Account:')
    account = node.account(ADDRESS)
    print(account)
    print()

    COUNT = 10
    print(f'First {COUNT} entries:')
    for entry in account.entries(to=COUNT):
        print(entry)

Example output:

Account:
FF9DA..E37D:     2,665,633.1703     #93

First 10 entries:
03E9.. O           10.0000 ECC0E..99EA FF9DA..E37D      #1 @ 20250415 18:03
2B82.. +           10.0000 ECC0E..99EA FF9DA..E37D      #2 @ 20250415 18:03
04D3.. +           10.0000 ECC0E..99EA FF9DA..E37D      #3 @ 20250415 18:05
5DF6.. +           10.0000 ECC0E..99EA FF9DA..E37D      #4 @ 20250415 18:06
7AB1.. +           10.0000 ECC0E..99EA FF9DA..E37D      #5 @ 20250415 18:07
1D46.. +           10.0000 ECC0E..99EA FF9DA..E37D      #6 @ 20250415 18:39
A710.. +           10.0000 ECC0E..99EA FF9DA..E37D      #7 @ 20250415 18:47
EE78.. +           10.0000 ECC0E..99EA FF9DA..E37D      #8 @ 20250415 18:49
E911.. +           10.0000 ECC0E..99EA FF9DA..E37D      #9 @ 20250415 18:50
C435.. +           10.0000 ECC0E..99EA FF9DA..E37D     #10 @ 20250415 18:52

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.

Need help?

I’m always available in the Atto Discord server. Feel free to get in touch.

For some insight into what inspired me to write this library, see this blog post.

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.9.1.tar.gz (38.0 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.9.1-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for atto_py-0.9.1.tar.gz
Algorithm Hash digest
SHA256 ef64a455796940daa6fa54c5eaef5079d387dee301248e2084c906b4f1300ede
MD5 45021cbed1df5d2b00620ea6d63ff037
BLAKE2b-256 92c56062d275b47bc64fbc53d17253d3a7b5206a6824ef9496ef9da562d071bd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for atto_py-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51520187c6958816b890e71f4437fea70ce13e0565e6c0d42f89db949709bd20
MD5 081a8e793ffa1555f2b021bb33e3aef7
BLAKE2b-256 c0988907a8eb0424c466e6126fd2abf74b3a9a8d5c1aa217370df98650f649fe

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