Skip to content

Djib-io/djib-python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Djib Python SDK

It's the base Python library for interacting with Djib network. You can use it interact with the Djib network.

Quickstart

Installation

pip install djib

General RPC Usage

from djib.rpc import DjibRpc

WALLET_PRIVATE_KEY = '<Base58 encoded string>'

try:
    rpc = DjibRpc(WALLET_PRIVATE_KEY, is_devnet=True)

    # status of drive
    response = rpc.status()

    if response.error:
        print(f"Error: {response.error['message']}, Code: {response.error['code']}, Data: {response.error['data']}")
    else:
        print(response.data)
except Exception as e:
    print(f"Error: {str(e)}")

KMS Usage

from djib.rpc import KmsClient

WALLET_PRIVATE_KEY = '<Base58 encoded string>'

try:
    kms = KmsClient(WALLET_PRIVATE_KEY, is_devnet=True)
    a = 'Hello, World!'
    a_enc = kms.encrypt(a)
    a_dec = kms.decrypt(a_enc)
    assert a_dec == a
except Exception as e:
    print(f"Error: {str(e)}")

Development

Setup

  1. Install poetry
  2. Install dev dependencies:
poetry install
  1. Activate the poetry shell.
poetry shell