Skip to content

Commit

Permalink
[common] update default argument handling in Extractor.request()
Browse files Browse the repository at this point in the history
more lines of code, but slightly less execution time
  • Loading branch information
mikf committed Sep 10, 2021
1 parent 0fd959a commit 2ff2974
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ def _config_shared_accumulate(self, key):

def request(self, url, *, method="GET", session=None, retries=None,
encoding=None, fatal=True, notfound=None, **kwargs):
tries = 1
retries = self._retries if retries is None else retries
session = self.session if session is None else session
kwargs.setdefault("timeout", self._timeout)
kwargs.setdefault("verify", self._verify)
if retries is None:
retries = self._retries
if session is None:
session = self.session
if "timeout" not in kwargs:
kwargs["timeout"] = self._timeout
if "verify" not in kwargs:
kwargs["verify"] = self._verify
response = None
tries = 1

if self.request_interval:
seconds = (self.request_interval -
Expand Down

0 comments on commit 2ff2974

Please sign in to comment.