Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wikibaseintegrator/wbi_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def __init__(self, user: Optional[str] = None, password: Optional[str] = None, m
}

headers = {
'User-Agent': get_user_agent(user_agent)
'User-Agent': get_user_agent(user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None))
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None) is redundant here. The variable user_agent was already resolved with the same fallback logic on line 215, so this line can be simplified to just get_user_agent(user_agent).

Suggested change
'User-Agent': get_user_agent(user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None))
'User-Agent': get_user_agent(user_agent)

Copilot uses AI. Check for mistakes.
}

allowed_kwargs = {'headers', 'proxies', 'timeout', 'verify'}
Expand Down Expand Up @@ -282,7 +282,7 @@ def __init__(self, user: Optional[str] = None, password: Optional[str] = None, m
}

headers = {
'User-Agent': get_user_agent(user_agent)
'User-Agent': get_user_agent(user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None))
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None) is redundant here. The variable user_agent was already resolved with the same fallback logic on line 274, so this line can be simplified to just get_user_agent(user_agent).

Suggested change
'User-Agent': get_user_agent(user_agent or (str(config['USER_AGENT']) if config['USER_AGENT'] is not None else None))
'User-Agent': get_user_agent(user_agent)

Copilot uses AI. Check for mistakes.
}

allowed_kwargs = {'headers', 'proxies', 'timeout', 'verify'}
Expand Down
Loading