About Measuring GraphQL Performance with Requests

You can check GraphQL query performance using the requests library, as follows:

>>> import requests
>>> url = "https://example.com/en/graphql/"
>>> query = """
... query {
... # YOUR GRAPHQL QUERY
... }"""
>>> headers = {
...     "Authorization": "Bearer YOUR_TOKEN_HERE",
...     "Content-Type": "application/json"
... }
>>> payload = {"query": query, "variables": {}}
>>> response = requests.post(url, json=payload, headers=headers)
>>> response.elapsed
datetime.timedelta(seconds=5, microseconds=849475)
>>> response.json()
{...}

Tips and Tricks Programming Performance Django 5.x Django 4.2 Django 3.2 requests Graphene-Django GraphQL