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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user