SentiChain Python Client
A lightweight Python client to interact with the SentiChain REST API.
This library provides convenience methods for:
- API Management: Retrieve user information (e.g., remaining points).
- Block Explorer: Get chain length, last block time, total transactions, etc.
- Event Map: Retrieve event map data for specified block ranges.
- Observation: Retrieve reasoning for specified ticker, summary type and block chunk end.
Table of Contents
Features
- API Management
- Fetch detailed user information, including points usage.
- Block Explorer
- Get chain length and last block time.
- Retrieve total number of transactions.
- Fetch the latest block or a specific block by number.
- Event Map
- Fetch maximum block number processed in the event map.
- Retrieve “points” snapshots for a specific block or for a range of blocks.
- Observation
- Retrieve reasoning for specified ticker, summary type and block chunk end.
Requirements
- Python 3.8+ (recommend)
Installation
To install this Python package, you can simply:
pip install sentichain
Usage
Initializing the Client
from sentichain import Client
# If you have an API key:
api_key = "YOUR_API_KEY"
# Initialize the client with the default SentiChain API URL
client = Client(api_key=api_key)
Examples
This is an example of how you might use this client:
from sentichain import Client
def main():
api_key = "YOUR_API_KEY" # Replace with your real key
client = Client(api_key=api_key)
# Get user info
user_info = client.get_user_info(user_id="12345", api_key=api_key)
print("User info:", user_info)
# Check chain length on testnet
length = client.get_chain_length("testnet")
print("Chain length:", length)
# Fetch data for a specific block
block_data = client.get_block_by_number(network="testnet", block_number=50)
print("Block #50 data:", block_data)
# Fetch reasoning for a specific ticker, summary type and block chunk end
reasoning = client.get_reasoning_match_chunk_end(ticker="DOGE", summary_type="observation_public", user_chunk_end=200)
print("Observation:", reasoning)
if __name__ == "__main__":
main()
Supports
Contributions, bug reports, and feature requests are welcome! Feel free to email us at info@sentichain.com
Release files for sentichain 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sentichain-0.2.2.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentichain-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / sentichain-0.2.2.tar.gz
| Download URL | sentichain-0.2.2.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3845741fbdcea2137f912b8ff83039c420cbdf7219c3e6a1a6a0618e731128bd
|
|
BLAKE2b-256 checksum How to use checksums |
7feb9ace48f95581ae0e3d1844649b5007ab7fc5b2f4ee4099dff994b4e577ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / sentichain-0.2.2-py3-none-any.whl
| Download URL | sentichain-0.2.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcbd809c7af41b5644d623139c178b2a48adb1841f2fb7cf4eee9e20e1d69573
|
|
BLAKE2b-256 checksum How to use checksums |
d75ca989a75fb9ee592881796aad0865a43548a6a009d03242bec1d1d5b11f9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|