Skip to content

Commit

Permalink
Initial definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor-Avila committed Aug 21, 2023
1 parent 9443edb commit 60cb7ba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/preset_cli/auth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from typing import Any, Dict

from requests import Response, Session
from urllib3.util import Retry
from requests.adapters import HTTPAdapter


class Auth: # pylint: disable=too-few-public-methods
Expand All @@ -16,6 +18,14 @@ def __init__(self):
self.session = Session()
self.session.hooks["response"].append(self.reauth)

retries = Retry(
total=3, # max retries count
backoff_factor=0.2, # delay factor between attempts
# respect_retry_after_header=True,
)

self.session.mount("https://", HTTPAdapter(max_retries=retries))

def get_headers(self) -> Dict[str, str]:
"""
Return headers for auth.
Expand Down

0 comments on commit 60cb7ba

Please sign in to comment.