import kalshi_python
from kalshi_python.models.get_milestones_response import GetMilestonesResponse
from kalshi_python.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
host = "https://api.elections.kalshi.com/trade-api/v2"
)
# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
private_key = f.read()
# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key
# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)
status = 'status_example' # str | Filter by milestone status (optional)
limit = 100 # int | Number of items per page (minimum 1, maximum 500) (optional) (default to 100)
try:
# Get Milestones
api_response = client.get_milestones(status=status, limit=limit)
print("The response of MilestonesApi->get_milestones:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MilestonesApi->get_milestones: %s\n" % e)