Read-only API interface for steamcmd app_info. The official API is reachable on api.steamcmd.net and it's documentation can be found on www.steamcmd.net.
The API can easily be run via a container image which contains the API code and the
uvicorn
tool to be able to respond to web requests. With every new version of
the API the Docker images is automatically rebuild and pushed to the Docker Hub:
docker pull steamcmd/api:latest
docker pull steamcmd/api:1.10.0
docker run -p 8000:8000 -d steamcmd/api:latest
The API consists of 2 services; the Web and the Job service and the Redis cache. The Job service and the Redis cache are both optional but are both required if you want to run the Job service.
Details on how the official API is hosted can be found in the platform repository. This repository contains all the infrastructure as code that is used to deploy the API on a Kubernetes cluster.
See the Development section for more information on running the API and Job services directly via Python.
When hosting the API yourself there are few settings you can change to configure
the API to your platform specifications. The easiest way is to create an .env
file in the src/
directory. Alternatively setting environment variables is
possible as well.
All the settings are optional. Keep in mind that when you choose a cache type
that you will need to set the corresponding cache settings for that type as well
(ex.: REDIS_HOST
, REDIS_PORT
, REDIS_PASSWORD
or REDIS_URL
is required
when using the redis type).
All the available options in an .env
file:
# general
VERSION=1.0.0
# caching
CACHE=True
CACHE_TYPE=redis
CACHE_EXPIRATION=120
# redis
REDIS_HOST="your.redis.host.example.com"
REDIS_PORT=6379
REDIS_PASSWORD="YourRedisP@ssword!"
# OR, if your host provides a Connection URL
# (see: https://redis-py.readthedocs.io/en/stable/#quickly-connecting-to-redis)
REDIS_URL="redis://YourUsername:YourRedisP@[email protected]:6379"
# logging
LOG_LEVEL=info
To develop locally start by creating a Python virtual environment and install the prerequisites:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Run the Web Service (FastAPI) locally by running the FastAPI development server:
source .venv/bin/activate
cd src/
fastapi dev web.py
Now you can reach the SteamCMD API locally on http://localhost:8000.
Run the Job Service (Celery) locally by running celery directly:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd src/
celery -A job worker --loglevel=info --concurrency=2 --beat
To keep things simple, Black is used for code style / formatting. Part of the pipeline will check if the code is properly formatted according to Black code style. You can install it locally via pip:
pip install black
And then simply run it agains the Python source code:
black src