Skip to main content

A Python SDK for interacting with Story.

Project description

Story SDK

Welcome to the documents for Story Python SDK. The Python SDK provides the APIs for developers to build applications with Story. By using the SDK, developers can create the resources like IP assets and perform actions to interact with the resource.

How to use Story Protocol SDK in Your Project

Install Story Protocol core SDK

Suppose you already have a node project or created a new node project. First, you need to install story_protocol_python_sdk in your project. You can use one of the following command to install the package:

Use pip:

pip install story_protocol_python_sdk web3

Besides the Story Protocol SDK package story_protocol_python_sdk, we also require the package web3 (https://pypi.org/project/web3/) to access the DeFi wallet accounts.

Initiate SDK Client

Next we can initiate the SDK Client by first setting up our wallet and then the client itself.

Set up your wallet

The SDK supports using web3 for initiating SDK client. Create a Python file and write the following code to initiate the client with a private key:

:information-source: Make sure to have WALLET_PRIVATE_KEY set up in your .env file.

import os
from dotenv import load_dotenv
from web3 import Web3

load_dotenv()
private_key = os.getenv('WALLET_PRIVATE_KEY')
rpc_url = os.getenv('RPC_PROVIDER_URL')

# Initialize Web3
web3 = Web3(Web3.HTTPProvider(rpc_url))

# Set up the account with the private key
account = web3.eth.account.from_key(private_key)

The preceding code created the account object for creating the SDK client.

Set up SDK client

To set up the SDK client, import StoryClient from story_protocol_python_sdk. Write the following code, utilizing the account we created previously.

:information-source: Make sure to have RPC_PROVIDER_URL for your desired chain set up in your .env file. We recommend using the public default one with RPC_PROVIDER_URL=https://aeneid.storyrpc.io.

from story_protocol_python_sdk import StoryClient

# Create StoryClient instance
aeneid_chain_id = 1315
story_client = StoryClient(web3, account, aeneid_chain_id)

Running test cases

  • Integration Tests
pytest
  • Unit Tests
pytest tests/unit/resources -v -ra -q

Release

Package Description
story_protocol_python_sdk A Python SDK for interacting with the Story Protocol.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Details see: CONTRIBUTING

Please make sure to update tests as appropriate.

License

MIT License

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

story_protocol_python_sdk-0.3.14.tar.gz (76.8 kB view details)

Uploaded Source

Built Distribution

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

story_protocol_python_sdk-0.3.14-py3-none-any.whl (124.8 kB view details)

Uploaded Python 3

File details

Details for the file story_protocol_python_sdk-0.3.14.tar.gz.

File metadata

File hashes

Hashes for story_protocol_python_sdk-0.3.14.tar.gz
Algorithm Hash digest
SHA256 02f51b62661e2e615afeea98f8aa73d13a4b62afc30e78c808f467c4d4aaae5e
MD5 d689c3d00149f2bc8d854e965632faaa
BLAKE2b-256 93bedb8ffb1bc2b5d5b5e941810c35ce9371c9f064c670a3e57d79bba00d0d30

See more details on using hashes here.

File details

Details for the file story_protocol_python_sdk-0.3.14-py3-none-any.whl.

File metadata

File hashes

Hashes for story_protocol_python_sdk-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 5344f4e53cc8618ccce6dceec06246ef67fd707a4ccfc1a50ef297f9ca0eaac5
MD5 7888b3b6e8e6c2b09eee16093e92119d
BLAKE2b-256 72013594bd02949456f8aea36f7a89c4fbe25d2606579aac9787d7e70452319d

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