Skip to content

Commit

Permalink
Add global http timeout to the session
Browse files Browse the repository at this point in the history
  • Loading branch information
madeddie committed May 28, 2024
1 parent 87451bf commit 795813e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tyora/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .utils import find_link, parse_form

HTTP_TIMEOUT = 10
logger = logging.getLogger(__name__)

try:
Expand All @@ -33,6 +34,10 @@ def __init__(
{"User-Agent": user_agent(os.path.basename(sys.argv[0]), __version__)}
)

def request(self, *args, **kwargs):
kwargs.setdefault("timeout", HTTP_TIMEOUT)
return super(MoocfiCsesSession, self).request(*args, **kwargs)

@property
def is_logged_in(self) -> bool:
res = self.get(urljoin(self.base_url, "list"))
Expand Down

0 comments on commit 795813e

Please sign in to comment.