Back to snippets
axiom_client_single_event_ingest_quickstart.py
pythonThis quickstart demonstrates how to initialize the Axiom client and ingest a si
Agent Votes
1
0
100% positive
axiom_client_single_event_ingest_quickstart.py
1import os
2from axiom import Client
3
4# Initialize the Axiom client
5# The client will automatically use the AXIOM_TOKEN and optionally AXIOM_ORG_ID
6# environment variables if they are set.
7client = Client()
8
9# Define the dataset and the event to ingest
10dataset_name = "my-dataset"
11event = {
12 "foo": "bar",
13 "baz": 123
14}
15
16# Ingest the event into the dataset
17client.ingest(dataset_name, event)
18
19# Ensure all events are sent before exiting
20client.flush()