Links

Python SDK

The Python SDK spicepy is the easiest way to use and query Spice in Python.

Requirements

  • Python 3.8+
The following packages are required and will be automatically installed by pip:
  • pyarrow
  • pandas
  • web3
Apple M1 Mac Requirements - How do I know if I have an M1?​

Installation

Install the spicepy package directly from the Spice Github Repository at https://github.com/spiceai/spicepy:
pip install git+https://github.com/spiceai/spicepy

Usage

Import spicepy and create a Client by providing your API Key.
You can then submit queries using the query function.
import spicepy
client = spicepy.Client('API_KEY')
block_data = client.query('SELECT * FROM eth.recent_blocks LIMIT 10;').read_pandas()
transaction_Data = client.query('SELECT * FROM eth.recent_transactions LIMIT 10;').read_pandas()
Client objects has the following arguments:
  • key (required) : the API key too authenticate with.
  • url (optional) : URL to the endpoint to connect to (default: grpc+tls://flight.spiceai.io).
  • tls_root_cert (optional): path to specific certificate to use for the TLS connection.

Contributing

Contribute to or file an issue with the spicepy library at https://github.com/spiceai/spicepy​