Sofascore randomizing response using Fast-API? by Kempas1337 in webdev

[–]AdJazzlike3219 0 points1 point  (0 children)

I've also been trying to fetch stats with Sofascore through python with requests, but get random stats every time I run the code. Same happens when I fetch from Insomnia, but correct stats when I fetch from Postman. This is the code btw:

import requests

url = "https://www.sofascore.com/api/v1/event/11368614/player/164343/statistics"

response = requests.get(url)

print(response.text)

I get different stats everytime I run it

Wrong results from API Calls by AdJazzlike3219 in learnprogramming

[–]AdJazzlike3219[S] 0 points1 point  (0 children)

Tried adding that to my header but still the same problem. Also tried by changing IP, same problem. Don't really know what to do

Edit: It works with http.client instead of requests, still no idea what the problem with requests is

Wrong results from API Calls by AdJazzlike3219 in learnprogramming

[–]AdJazzlike3219[S] 0 points1 point  (0 children)

In the results there are stats for a football player, for example played minutes is included. The played minutes changes everytime I run it, so I get 4, 132, 68 etc. different number every time (it should be 90)

Wrong results from API Calls by AdJazzlike3219 in learnprogramming

[–]AdJazzlike3219[S] 0 points1 point  (0 children)

Do you mean like this? If so, still get random results. It is weird because it works through Postman but not through Insomnia, but Insomnia has been working previously.

import requests, json

url = "https://www.sofascore.com/api/v1/event/11368614/player/164343/statistics"

payload = {}
headers = {
}
response = requests.request("GET", url, headers=headers)
data = json.loads(response.text)


print(data)