Skip to main content

Getting Started with Python

Security

Password Storage

Never 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

Install the Library

Clone the Repository

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

git clone 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/client/bindings/python/native

Install the Required Dependencies and Build the Wheel

Once you have cloned the library, and moved to the binding's directory, you should install dependencies and build the wheel file.

You can do so by running the following commands:

pip install -r requirements-dev.txt
pip install .

(optional) Create and Use a Virtual Environment

If you want to isolate the library from the rest of your system, you can create a virtual environment by running the following commands:

Linux/MacOs

python3 -m venv iota_client_venv
source iota_client_venv/bin/activate

Windows

.\iota_client_venv\Scripts\activate

(optional) Deactivate the virtual environment

If you want to deactivate the virtual environment, you should run the following command from the virtual environment:

deactivate

Use the Library

After you installed the library, you can create a IotaClient instance and interface with it.

from iota_client import IotaClient

# Create an IotaClient instance
client = IotaClient({'nodes': ['https://api.testnet.shimmer.network']})

# Get the node info
node_info = client.get_info()
print(f'{node_info}')

What's Next?

Now that you are up and running, you can get acquainted with the library using its how-to guides and the repository's code examples.