Skip to main content
Version: IOTA

Getting Started with IOTA Client Python Binding

Security

Password Storage

It is not recommended to store passwords or seeds on a host's environment variables or in the source code in a production setup. Please follow our backup and security recommendations for production use.

Requirements

Installation

Install prebuild libraries

Easiest way how to get python binding up and running is to leverage pre-built python libraries for linux/macos/windows that can be installed to your python environment (3.6+) via pip. The binding is automagically generated using github actions.

The latest artifacts for major python versions can be also grabbed using nighly.link service. Download zip file for the given os and pyversion, unpack wheel file (.whl) and install it via pip:

pip install <wheel_file>

Install from source

Additional Requirements

  • Rust and Cargo.
  • (for Linux only) libudev. You can install it with apt install libudev-dev.

Clone the Repository

You can clone the iota.rs client library by running the following command:

git clone -b production https://github.com/iotaledger/iota.rs

Change to the Python Binding Directory

After you have cloned the repository, you should change directory to iota.rs/bindings/python/native. You can do so by running the following command:

cd iota.rs/bindings/python/native

Install the Required Dependencies and Build the Wheel

Install and run maturin:

pip3 install maturin
maturin develop
maturin build --manylinux off

The wheel file is now created in bindings/python/native/target/wheels. You can install it with:

pip3 install [THE_BUILT_WHEEL_FILE]

Once it has been properly installed you can double check it using pip:

pip list

You should see the similar output:

Package                    Version
-------------------------- -------
iota-client-python 0.2.0a3

Once installed in the given python environment you are all set and can start hacking using python binding!

Usage

import iota_client
print(iota_client.__doc__)
print(dir(iota_client))

client = iota_client.Client(nodes_name_password=[['https://api.lb-0.h.chrysalis-devnet.iota.cafe']])

print('get_health()')
print(f'health: {client.get_health()}')

print('get_info()')
print(f'node_info: {client.get_info()}')