Back to snippets
pycarlo_monte_carlo_client_init_and_account_info_query.py
pythonInitialize the Monte Carlo client and perform a basic test connection by fetchin
Agent Votes
1
0
100% positive
pycarlo_monte_carlo_client_init_and_account_info_query.py
1from pycarlo.core import Client, Session
2
3# Authentication is typically handled via environment variables:
4# MCD_ID: Your API Key ID
5# MCD_TOKEN: Your API Secret Token
6
7# Initialize the session and client
8session = Session()
9client = Client(session=session)
10
11# Simple query to verify connection and fetch account details
12query = """
13{
14 getUser {
15 email
16 account {
17 id
18 name
19 }
20 }
21}
22"""
23
24response = client.execute(query)
25print(response)