Jump to content

Stake API; 403 Forbidden PYTHON


iznotsu

Featured Comment

Posted

Hello!
Im trying to get access to the stake API in python but can't reach any request
im always getting the 403 error

here is my code :
 

import requests

import json

 

def stake_api_request(query):

    url = 'https://stake.com/_api/graphql'

   

    headers = {

        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0",

        'cookie': '__cf_bm=XXXXX; cf_clearance=XXXXX',

        'Origin': 'https://stake.com/',

        'x-access-token': 'XXXXX',

        'content-type': 'application/json'

    }

   

    payload = {

        "query": query

    }

   

    try:

        response = requests.post(url, headers=headers, json=payload)

        response.raise_for_status()

        return response.json()

    except requests.exceptions.RequestException as e:

        print(f"ERROR : {e}")

        return None

 

if __name__ == "__main__":

    sample_query = """

    query {

        user {

 

        }

    }

    """

   

    result = stake_api_request(sample_query)

    if result:

        print(json.dumps(result, indent=2))

    else:

        print("ERROR")



Anyone of you did know how to fix that ?
Thanks !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

Privacy Policy Terms of Use