ddapi is an api from the ddnet and qwik website
pip install ddapi
or
pip install git+https://github.com/ByFox213/ddapi
DDnet
import asyncio
from ddapi import DDnetApi, DDPlayer
async def main():
async with DDnetApi() as obj:
user: DDPlayer = await obj.player("Cor")
if user is not None:
text = f"{user.player}: {user.points.points}/{user.points.total}"
percent = round(user.points.total / user.points.points * 100)
print(f"{text}({percent}%)")
# Cor: 32950/32950(100%)
else:
print("Player not found")
asyncio.run(main())
Tested on Python
3.10 | 3.11 | 3.12 |
---|---|---|
✅ | ✅ | ✅ |