p
import requests
import json
from requests.auth import HTTPBasicAuth
# Define the GraphQL endpoint
url = 'https://graphql-demo.mead.io/'
# Define user ID and password for authentication
user_id = 'your_user_id'
password = 'your_password'
# Define the GraphQL query with date range filter
query = """
{
events(filter: { startDate: { gte: "2023-01-01" }, endDate: { lte: "2023-01-31" } }) {
id
name
date
location
}
}
"""
# Perform the query with authentication
response = requests.post(url, json={'query': query}, auth=HTTPBasicAuth(user_id, password))
data = response.json()
# Print the result
print(json.dumps(data, indent=2))
Comments
Post a Comment