Skip to content

samhagan/spicepy

 
 

Repository files navigation

spicepy

Spice.xyz client library for Python.

Installation

pip install git+https://github.com/spiceai/spicepy

Usage

Arrow Query

from spicepy import Client

client = Client('API_KEY')
data = client.query('SELECT * FROM eth.recent_blocks LIMIT 10;')
pd = data.read_pandas()

Querying data is done through a Client object that initialize the connection with Spice endpoint. Client have the following arguments:

  • api_key (string, required): API key to authenticate with the endpoint.
  • url (string, optional): URL of the endpoint to use (default: grpc+tls://flight.spiceai.io)
  • tls_root_cert (Path or string, optional): Path to the tls certificate to use for the secure connection (ommit for automatic detection)

Web3 interface

Once a client is created you can also use the web3.py interface under the w3 attribute.

from spicepy import Client

client = Client('API_KEY')
print(client.w3.eth.get_block_number())

Documentation

Check out our Documentation to learn more about how to use the Python SDK.

About

Python SDK for Spice.xyz

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.6%
  • Makefile 5.4%