Skip to main content

Rekord.io Python SDK

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Rekord.io Python SDK

PyPI version

Official Python SDK for Rekord.io.

Rekord.io provides a trust layer for verifiable data, anchoring data on-chain to create immutable, audit-ready records for regulatory compliance and data integrity.

Installation

Install via pip:

pip install rekord-io-sdk

Configuration

The SDK uses rekord_sdk.Configuration to manage API credentials and endpoints.

Authentication

Rekord.io uses Auth0 OAuth2 Client Credentials Flow. To use this SDK, you need to handle the OAuth2 token retrieval and inject it into the configuration.

Prerequisites:

  • Rekord.io API Endpoint (e.g., https://api-v2-dev.rekord.io)
  • Auth0 Access Token (Bearer token)

Usage Example

1. Initialize Client

import rekord_sdk
from rekord_sdk.rest import ApiException

# Configure the client
configuration = rekord_sdk.Configuration()
configuration.host = "https://api-v2-dev.rekord.io"

# Inject the Bearer token (you must obtain this from Auth0 separately)
access_token = "YOUR_ACCESS_TOKEN"

# Override auth settings to use the token
original_auth_settings = configuration.auth_settings

def auth_settings_with_token():
    settings = original_auth_settings()
    settings["bearerAuth"] = {
        "type": "bearer",
        "in": "header",
        "key": "Authorization",
        "value": f"Bearer {access_token}",
    }
    return settings

configuration.auth_settings = auth_settings_with_token

# Create API Client instances
api_client = rekord_sdk.ApiClient(configuration)
passport_api = rekord_sdk.PassportApi(api_client)

2. Create a Passport

A "Passport" is a container for your data artifacts. It is typically created once per day or per logical grouping.

try:
    # Define an artifact (the data you want to anchor)
    artifact = {
        "json": {
            "event": "market_data",
            "symbol": "BTC/USD",
            "price": 65000.00,
            "timestamp": "2024-01-01T12:00:00Z"
        },
        "filename": "btc_price_20240101_1200.json",
        "mimeType": "application/json"
    }

    # Create passport with initial artifact
    body = {
        "passport_label": "market-data-btc-20240101",
        "artifacts": [artifact]
    }

    response = passport_api.passport_create_post(body=body)

    # Extract Passport ID
    passport_id = response.data.passport_id
    print(f"Passport Created: {passport_id}")

except ApiException as e:
    print(f"Error creating passport: {e}")

3. Append Artifacts to Existing Passport

You can append new data files (artifacts) to an existing passport. This updates the record on-chain.

try:
    new_artifact = {
        "json": {
            "event": "market_data",
            "symbol": "BTC/USD",
            "price": 65100.00,
            "timestamp": "2024-01-01T13:00:00Z"
        },
        "filename": "btc_price_20240101_1300.json",
        "mimeType": "application/json"
    }

    body = {
        "new_artifacts": [new_artifact]
    }

    # Update passport using the ID obtained from creation
    response = passport_api.passport_passport_id_update_post(
        passport_id="YOUR_PASSPORT_ID",
        body=body
    )
    print("Passport Updated Successfully")

except ApiException as e:
    print(f"Error updating passport: {e}")

Core Concepts

  • Passport: A digital container that holds a collection of artifacts. Passports are anchored on-chain.
  • Artifact: A specific piece of data (file, JSON, document) that is added to a passport.
  • Record: The individual immutable entry created on the blockchain for each update.

Requirements

  • Python 3.4+
  • urllib3 >= 1.15
  • six >= 1.10
  • certifi
  • python-dateutil

License

MIT

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

rekord_io_sdk-1.0.3.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rekord_io_sdk-1.0.3-py3-none-any.whl (132.3 kB view details)

Uploaded Python 3

File details

Details for the file rekord_io_sdk-1.0.3.tar.gz.

File metadata

  • Download URL: rekord_io_sdk-1.0.3.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for rekord_io_sdk-1.0.3.tar.gz
Algorithm Hash digest
SHA256 24c9850a3413c3d2569f4e9b824aeee0505c1cc3a3c6aee3f9f42dd5d24fe170
MD5 84b9f5648518420adb88cf0d55acd07d
BLAKE2b-256 98a6b91575061a38d654665cfb8e23373970eaf68e228dee027d4de393fa5282

See more details on using hashes here.

File details

Details for the file rekord_io_sdk-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: rekord_io_sdk-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 132.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for rekord_io_sdk-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 729fb64f922f1d2d747281c30c6a73995721f7bbe2e0fb3c438c11ac2332a4fc
MD5 1cb61500ae4dcb861c762fc6be9ce5da
BLAKE2b-256 5d547770597aab33eb5d532fd9d416812e564acf62905538f4e644ca002e147b

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