soccerapi-server is a repo created to support the soccerapi repo with not-python code running in the background to serve to soccerapi Python package. Currently it only contains a script to obtain a specific Bet365 header required to make calls for the Bet365 api (read below for further details). In the future if additional background scripts will be needed, they will be integrated in the docker and added here.
To run everything smoothly in background with no window popping up and no need to worry about dependencies, install Docker and run the deamon on your machine. To download and update the soccerapi-server docker
docker pull s1m0n38/soccerapi
This command pull the soccerapi image from Docker Hub. The image is quite heavy (944 MB) because it packs all the dependencies needed to run soccerapi-server (linux, node, chromium, graphical libraries to run chromium in "headful" mode).
After you have s1m0n38/soccerapi
on your local machine, to run it simply type
docker run --rm -it -p 5000:5000 s1m0n38/soccerapi
To kill the process and stop the docker just use Ctrl+C
At the beginning of 2021 bet365 implemented authentication with the X-Net-Sync-Term header for pre-match odds. It's now mandatory to send a valid X-Net-Sync-Term header with every http requests. This XNST (X-Net-Sync-Term) is generated by client side JavaScript but due to obfuscation of the code it is complicated to reverse-engineer the script to generate the header on your own.
The approach followed here is to generate a valid XNST with a browser and then use the newly generated XNST for your http requests.
soccerapi-server every 10 minutes generates a valid XNST and exposes it on the
localhost. While the docker container is running in background (see
Installation & Usage) you have a valid X-Net-Sync-Term at
http://localhost:5000/bet365
.
The soccerapi package automatically picks the XNST posted by the docker on the localhost. Then in order to retreive data from Bet365 with soccerapi you need to have the docker running in the background.