Skip to content

Commit

Permalink
fix ua null behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyheppell committed Aug 12, 2024
1 parent 76e4329 commit 7825c1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/wpextract/download/requestsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __init__(
max_retries: int = 10,
backoff_factor: float = 0.1,
max_redirects: int = 20,
user_agent: str = DEFAULT_UA,
user_agent: Optional[str] = None,
):
"""Create a new request session.
Expand Down Expand Up @@ -239,7 +239,7 @@ def __init__(
self.timeout = timeout
self._mount_retry(backoff_factor, max_redirects, max_retries)
self.waiter = RequestWait(wait, random_wait)
self.user_agent = user_agent
self.user_agent = user_agent if user_agent is not None else DEFAULT_UA

def _mount_retry(
self, backoff_factor: float, max_redirects: int, max_retries: int
Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def test_wait_random_validation(mocker, runner, datadir):
)
assert result.exit_code == 0


def test_custom_ua(mocker, runner, datadir):
req_mock, dl_mock, result = mock_cls_invoke_req_sess(
mocker, runner, datadir, ["--user-agent", "test"]
Expand Down

0 comments on commit 7825c1d

Please sign in to comment.