Skip to content

Commit

Permalink
Remove requsts
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelseeger committed Sep 12, 2024
1 parent 120e0b4 commit 8341683
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions aicoach/functions/LookupPlayer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from .base import AIFunction
from typing import Annotated
import requests
import logging
from typing import Annotated

import httpx

from config import config

from .base import AIFunction

log = logging.getLogger(f"{config.name}.{__name__}")

PROFILE_BASE = "https://starcraft2.com/en-us/profile/"
Expand All @@ -24,13 +27,14 @@ def LookupPlayer(
Only call this function with valid toon handles in the format 2-S2-1-1849098.
"""
raise NotImplementedError("This function is not implemented yet.")
summary = {}
try:
handle = toon_handle.replace("-S2-", "/").replace("-", "/")

api_url = API_BASE + handle

with requests.Session() as s:
with httpx.Client() as s:
r = s.get(api_url, timeout=10)

if r.status_code != 200:
Expand Down
1 change: 0 additions & 1 deletion environment-cp311-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- python-levenshtein
- blinker
- jinja2
- httpx
- pip
- pip:
- opencv-python
Expand Down
2 changes: 1 addition & 1 deletion mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DB_NAME="MyReplays"

Startup local DB with

```seh
```sh
dockercompose up
```
This will set up a locally running MongoDB with database $DB_NAME and the credentials from the .env file. Populate it by importing from an existing DB or import replays with [../repcli.py](../repcli.py).
Expand Down

0 comments on commit 8341683

Please sign in to comment.