GraphQL request for ftching products is not working properly. It is returning an html instead json

im trying to implement a python script that will update every product’s alt text image to a specific text. My code initially is this:

import requests 
import json 
import re

# Define your Shopify store's API key and password
API_KEY = '88xxxxxxxxxxxxxxxxxxxxxxxxxxxxf'
PASSWORD = '0xxxxxxxxxxxxxxxxxxxxxxxxxxxx4'
API_TOKEN = 'xxxx_xxxxxxxxxxxxxxxxxxxxxxx'

SHOPIFY_DOMAIN = 'https://www.xxxx.yyyy/'
# Define your Shopify store's GraphQL endpoint
GRAPHQL_ENDPOINT = 'https://www.xxxx.yyyy/admin/api/2024-04/graphql'

headers = {
    'X-Shopify-Access-Token': 'xxxx_xxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
}

# GraphQL query
query = """
query MyQuery {
  products(first: 50) {
    edges {
      node {
        id
        images(first: 1) {
          edges {
            node {
              id
              altText
            }
          }
        }
      }
    }
  }
}
"""

# JSON payload
payload = {
    "query": query
}

# Make the POST request
response = requests.post(GRAPHQL_ENDPOINT, json=payload, headers=headers)

# # Check if the request was successful
if response.status_code == 200:
    # Parse the JSON response
    data = response.json()
    # print(json.dumps(data, indent=4))
else:
    print(f"Query failed to run with a status code {response.status_code}")
    print(response.text)

-------------------------OUTPUT---------------------------

<html>\n .......... </body>\n</html>\n'
 

What am i missing?