jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1194032?usp=email )
Change subject: IMPR: Show user-agent with version script
......................................................................
IMPR: Show user-agent with version script
Bug: T406458
Change-Id: If1ed512803e4609d67e36977ba61a7a524e90844
---
M pywikibot/scripts/version.py
1 file changed, 19 insertions(+), 2 deletions(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 454f7f0..661432b 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -7,9 +7,24 @@
registered family
.. versionchanged:: 7.0
- version script was moved to the framework scripts folder
+ version script was moved to the framework scripts folder.
.. versionadded:: 9.1.2
- the *-nouser* option.
+ the *-nouser* option was added.
+.. versionchanged:: 10.6
+ The User-Agent string is now printed for the default site. To print
+ it for another site, call the ``pwb`` wrapper with the global option,
+ e.g.:
+
+ pwb -site:wikipedia:test version
+
+ .. note::
+ The shown UA reflects the default config settings. It might differ
+ if a user-agent is passed via the *headers* parameter to
+ :func:`comms.http.request`, :func:`comms.http.fetch` or to
+ :class:`comms.eventstreams.EventStreams`. It can also differ if
+ :func:`comms.http.fetch` is used with *use_fake_user_agent* set to
+ ``True`` or to a custom UA string, or if
+ *fake_user_agent_exceptions* is defined in the :mod:`config` file.
"""
#
# (C) Pywikibot team, 2007-2025
@@ -23,6 +38,7 @@
from pathlib import Path
import pywikibot
+from pywikibot.comms.http import user_agent
from pywikibot.version import getversion
@@ -93,6 +109,7 @@
pywikibot.info(' Please reinstall requests!')
pywikibot.info('Python: ' + sys.version)
+ pywikibot.info('User-Agent: ' + user_agent(pywikibot.Site()))
# check environment settings
settings = {key for key in os.environ if key.startswith('PYWIKIBOT')}
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1194032?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If1ed512803e4609d67e36977ba61a7a524e90844
Gerrit-Change-Number: 1194032
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Jon Harald Søby <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]