Jump to content

Stake API; 403 Forbidden PYTHON


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 !

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Privacy Policy Terms of Use