Inspired by github-readme-stats, I wanted to make a similar tool for codingame profiles.
- Copy-paste this code snippet into your markdown content
- Replace the
<your_codingamer_id>with your id. your codingamer ID can be found in the url of your own profilehttps://www.codingame.com/profile/<your_codingamer_id> - That is it 👍.
You can also use an <img> tag with a width of:
width=390pxfor a single column formatwidth=610pxfor a two-column formatwidth=830pxfor a three-column format
<img alt="Coverage" src="https://codingamereadmestats.pythonanywhere.com/api/details/magic" width="410px" height="220px"/>
<img alt="Coverage" src="https://codingamereadmestats.pythonanywhere.com/api/details/magic?online=false&second=certifications" width="640px" height="220px"/>You can decide to which content you want for every 'column'. Available options are:
certifications: Current level on every certificationslanguages: Topnlanguages to display with number of puzzle solvedleaderboard: Current ranking on every categories and globalpuzzles: Some figures based on puzzles completions
You can set the column using the arguments:
first: default is leaderboardsecond: default is "hidden"third: default is "hidden"
If you use leaderboard, you can add percentage ranking using the argument percent with 1, true or yes.
If you use languages, you can limit the number of visible languages with top=n with 1 <= n <= 6 (default = 6))
A dark mode is available using the argument night with 1, true or yes.
In order to reduce the number of request to Codingame's APIs.
- The result of the request is cached and will not change for 24 hours (Codingame's profiles are anyway updated only once a day).
- A restriction of call is applied per IP address:
- 1 request every 5 seconds (this one may change as it could create issues if you put multiple badge on your profile)
- 60 requests every hour
- 200 requests every day
- The returned image should be cached by the browser
- fix issue with CG's icon is single column format
Other ideas are welcome 😉
git clone https://github.com/Coni63/codingame-readme-stats.git
cd codingame-readme-statscd api
python -m venv venv
venv/Scripts/activate.ps1
pip install -r requirements.txtcd api
mkvirtualenv venv --python=/usr/bin/python3.10
workon venv
pip install -r requirements.txtYou can run locally the application by running the following command and then go to
http://localhost:8000/api/details/<your_codingamer_id>. For the development, it is recommended to use the your_codingamer_id "magic". It uses a local fake data instead of calling Codingame's API at every refresh.
cd api
venv/Scripts/activate.ps1 # or source venv/bin/activate or workon venv
python app.pyYou can run tests / coverage simply by running the following commands:
cd api
venv/Scripts/activate.ps1 # or source venv/bin/activate or workon venv
coverage run -m unittest discoverIf you want to go further, here is some usefull commands to use
coverage xml # create the cobertura coverage.xml file -- do not commit it
coverage json # same file but in json -- do not commit it
coverage html # generate a htmlcov folder with coverage result as HTML file -- do not commit it
coverage report # get report in the console
python -m unittest discover # run only unittest and don't evaluate coverage
python -m unittest test_module1 test_module2 # run only some modules
python -m unittest test_module.TestClass # run only one class in a module
python -m unittest test_module.TestClass.test_method # run only 1 test in a classIn case you install a new dependency, don't forget to update the requirements.txt 😉
cd api
venv/Scripts/activate.ps1 # or source venv/bin/activate or workon venv
pip freeze > requirements.txt