Python SDK Documentation Now Available
ยท 4 min read
We're excited to announce comprehensive documentation for the Python SDK for Convex! Python developers can now build on the Convex decentralised lattice with Pythonic idioms and patterns.
What is convex-api?โ
The convex-api package is the official Python client library for the Convex decentralised lattice network. It provides a Pythonic interface with synchronous I/O, snake_case naming, and familiar exception handling.
pip install convex-api
Key Featuresโ
๐ Pythonic APIโ
Idiomatic Python with familiar patterns:
from convex_api import Convex, KeyPair
convex = Convex('https://peer.convex.live')
key_pair = KeyPair()
account = convex.create_account(key_pair)
# Pythonic method names
balance = convex.get_balance(account)
info = convex.get_account_info(account)
๐ฆ Account Objectsโ
Encapsulate address, key pair, and optional name:
from convex_api import Account, KeyPair
key_pair = KeyPair()
account = Account(key_pair, address=1234, name='alice')
print(f'Address: {account.address}')
print(f'Public Key: {account.public_key}')
๐ Flexible Key Managementโ
Multiple ways to create and import keys:
# Generate new keys
key_pair = KeyPair()
# Import from encrypted file
key_pair = KeyPair.import_from_file('my_keys.pem', 'password')
# Import from mnemonic phrase
key_pair = KeyPair.import_from_mnemonic('word1 word2 word3 ...')
# Export for backup
key_pair.export_to_file('backup.pem', 'password')
mnemonic = key_pair.export_to_mnemonic