diff --git a/db_model.py b/db_model.py new file mode 100644 index 0000000..a1cbd4e --- /dev/null +++ b/db_model.py @@ -0,0 +1,26 @@ +import peewee + + +database = peewee.Proxy() + + +class BaseModel(peewee.Model): + class Meta: + database = database + + +class CoDUser(BaseModel): + user = peewee.TextField() + + +class CoDStats(BaseModel): + ts = peewee.DateTimeField() + typ = peewee.TextField() + value = peewee.FloatField() + + class Meta: + primary_key = peewee.CompositeKey('ts', 'typ') + + +def create_tables(): + database.create_tables([TestPeewee]) diff --git a/get_cod_stats.py b/get_cod_stats.py new file mode 100644 index 0000000..be5ee7e --- /dev/null +++ b/get_cod_stats.py @@ -0,0 +1,19 @@ +""" +Links: +https://api.tracker.gg/api/v2/modern-warfare/standard/profile/battlenet/Hofei%232237 +https://api.tracker.gg/api/v2/modern-warfare/standard/profile/battlenet/Hofei%232237/segments/killstreak? +https://api.tracker.gg/api/v2/modern-warfare/standard/profile/battlenet/Hofei%232237/segments/weapon? +""" + +import requests +import json +import toml +import pprint + +URL = "https://api.tracker.gg/api/v2/modern-warfare/standard/profile/battlenet/Hofei%232237" +r = requests.get(URL) +j_r = json.loads(r.text) + +#pprint.pprint(j_r) + +print(j_r["data"]) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8fda0d7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +peewee~=3.13.3 +requests~=2.23.0 +toml~=0.10.0 \ No newline at end of file