1
0
forked from Mirrors/itch-dl

Add a Settings system

Allows permanently configuring itch-dl with an API key and other things
in the future. Adds a new dependency, Pydantic, to validate the config.
This commit is contained in:
Ryszard Knop
2022-06-12 19:28:31 +02:00
parent f8f3e45a1b
commit 4542057654
5 changed files with 39 additions and 22 deletions

View File

@@ -8,11 +8,12 @@ from .consts import ITCH_API
class ItchApiClient:
def __init__(self, api_key: str, base_url: Optional[str] = None):
def __init__(self, api_key: str, user_agent: str, base_url: Optional[str] = None):
self.base_url = base_url or ITCH_API
self.api_key = api_key
self.requests = Session()
self.requests.headers['User-Agent'] = user_agent
retry_strategy = Retry(
total=5,