RomainTessier Posted January 2, 2024 #1 Posted January 2, 2024 Hello everyone! I'm relatively new in the programming industry and I wanted to mess around a little bit with the Stake API because I'm into gambling. I want to know if someone could help me figure out the python script on order to be able to return the live odds of table tennis / pingpong matches. I did not find an answer as how to get live odds for specific event using the API , since there is absolutely no documentation. If someone could help me out, would be very helpful:) Thank you
watanabe91 Posted January 27, 2024 #2 Posted January 27, 2024 where you able to make some transaction using python? i mean just checking balance
Blackshires Posted February 15, 2024 #3 Posted February 15, 2024 Stake API is very powerful and we are a lot using it. You don't need any documentation to use, it, just look at the request made by your browser (F12-> Dev options). You will see graphql requests, you can use them to do anything you do in real, like get balance, get live matches, place a bet, play dice, BJ,... I use it everyday, in the graphql request you can see the payload, just send this to the endpoint that your browser use, usually https://stake.com/_api/graphql my generic function look like this: res = session.post( "https://stake.com/_api/graphql", headers={"x-access-token": api_key,},json={"query": query,"variables":variables}) response_data = res.json() return response_data where query is your query, for example to retrieve balance: query = "query StakeBalances($available: Boolean = true, $vault: Boolean = false) {\r\n user {\r\n id\r\n balances {\r\n available @include(if: $available) {\r\n currency\r\n amount\r\n __typename\r\n }\r\n vault @include(if: $vault) {\r\n currency\r\n amount\r\n __typename\r\n }\r\n __typename\r\n }\r\n __typename\r\n }\r\n}"; you can adapt this as you need, of course. variables is used for some requests, if you need to send data, like which sports,...for balances just send "{}"
reallyLucky Posted March 3, 2024 #4 Posted March 3, 2024 Could anybody provide a working example in Python? - Thank you! This below is not working for me. ____ # START import requests API_KEY = <HERE COMES MY STAKE API KEY> __cf_bm = <HERE COMES THIS COOKIE> url = "https://stake.com/_api/graphql" myObj = { "query": {}, "variables": {} } headers = { "X-Access-Token": API_KEY, "__cf_bm": __cf_bm } def stake(): res = requests.post(url = url, headers = headers, json = myObj) data = res.json() print(data) stake() # END
IqueSouza Posted April 25, 2024 #5 Posted April 25, 2024 On 03/03/2024 at 11:54, reallyLucky said: Alguém poderia fornecer um exemplo prático em Python? - Obrigado! Isso abaixo não está funcionando para mim. ____ # INICIAR solicitações de importação API_KEY = <AQUI VEM MINHA CHAVE DE API STAKE> __cf_bm = <AQUI VEM ESTE COOKIE> url = "https://stake.com/_api/graphql" myObj = { "query": {}, "variáveis ": {} } cabeçalhos = { "X-Access-Token": API_KEY, "__cf_bm": __cf_bm } def stake(): res = requests.post(url = url, headers = headers, json = myObj) data = res.json() print(data) aposta() # FIM Create a session using the tls_client library (install it using pip install) Use this session to make post requests. No need to include cf_clearance in the request
ErRubio Posted September 4, 2024 #6 Posted September 4, 2024 22 minutes ago, ErRubio said: Good afternoon, I am trying to launch a request with HttpClientInterface symfony PHP with API token and I always get a 403 error and the response is an HTML with the text just a moment. Could someone pass a working example of any request that accesses stake. Thanks for everything. On 2/15/2024 at 4:30 PM, Blackshires said: Stake API is very powerful and we are a lot using it. You don't need any documentation to use, it, just look at the request made by your browser (F12-> Dev options). You will see graphql requests, you can use them to do anything you do in real, like get balance, get live matches, place a bet, play dice, BJ,... I use it everyday, in the graphql request you can see the payload, just send this to the endpoint that your browser use, usually https://stake.com/_api/graphql my generic function look like this: res = session.post( "https://stake.com/_api/graphql", headers={"x-access-token": api_key,},json={"query": query,"variables":variables}) response_data = res.json() return response_data where query is your query, for example to retrieve balance: query = "query StakeBalances($available: Boolean = true, $vault: Boolean = false) {\r\n user {\r\n id\r\n balances {\r\n available @include(if: $available) {\r\n currency\r\n amount\r\n __typename\r\n }\r\n vault @include(if: $vault) {\r\n currency\r\n amount\r\n __typename\r\n }\r\n __typename\r\n }\r\n __typename\r\n }\r\n}"; you can adapt this as you need, of course. variables is used for some requests, if you need to send data, like which sports,...for balances just send "{}"
callmepaul Posted September 5, 2024 #7 Posted September 5, 2024 Hey @ErRubio, I am seeing the same. I tried with code in JS and Python, and in every case, the same error. I suspect based on the returned HTML that it is a Cloudflare thing that is preventing us from making the API call, but I am not sure if it is because we are making a wrong call or some other thing. If anyone can provide a full working example (and recent) in any language, that would help a lot. Thanks in advance!
yunusaputra46 Posted September 5, 2024 #8 Posted September 5, 2024 API_KEY = <HERE COMES MY STAKE API KEY> __cf_bm = <HERE COMES THIS COOKIE> url = "https://stake.com/_api/graphql" myObj = { "query": {}, "variables": {} } headers = { "X-Access-Token": API_KEY, "__cf_bm": __cf_bm } def stake(): res = requests.post(url = url, headers = headers, json = myObj) data = res.json() print(data) this mate try now
callmepaul Posted September 6, 2024 #9 Posted September 6, 2024 thanks @yunusaputra46testing it now, I will let you know, thanks for your time!
ErRubio Posted September 19, 2024 #10 Posted September 19, 2024 I have managed to get an http 200 OK, but the problem is that when doing the getContent() of the response. I get the following error. Idle timeout reached for "https://stake.com/_api/graphql"
ofcRS Posted October 16, 2024 #11 Posted October 16, 2024 Does anybody know what "identificator" field means in the makeBet request? just random id that was generated on client side?
Featured Comment
Archived
This topic is now archived and is closed to further replies.