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 <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Jon Harald Søby <jhsoby(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193560?usp=email )
Change subject: [IMPR] Add return after super(UI).encounter_color() call
......................................................................
[IMPR] Add return after super(UI).encounter_color() call
If none of stdin, stdout, or stderr is used, Win32UI.encounter_color()
calls the base class implementation. This is not critical because the
base class only raises NotImplementedError. However, returning after
this call is safer, since the base implementation might change in the
future and 'addr' would not be defined in such a case, leading to a
NameError.
Change-Id: I06007e07acfe2a64c564eaa553e4e897cbcf770d
---
M pywikibot/userinterfaces/terminal_interface_win32.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/userinterfaces/terminal_interface_win32.py b/pywikibot/userinterfaces/terminal_interface_win32.py
index 604fb6b..1001eda 100644
--- a/pywikibot/userinterfaces/terminal_interface_win32.py
+++ b/pywikibot/userinterfaces/terminal_interface_win32.py
@@ -1,6 +1,6 @@
"""User interface for Win32 terminals."""
#
-# (C) Pywikibot team, 2003-2024
+# (C) Pywikibot team, 2003-2025
#
# Distributed under the terms of the MIT license.
#
@@ -57,6 +57,7 @@
addr = -12
else:
super().encounter_color(color, target_stream)
+ return
from ctypes.wintypes import DWORD, HANDLE
get_handle = ctypes.WINFUNCTYPE(HANDLE, DWORD)(
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193560?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: I06007e07acfe2a64c564eaa553e4e897cbcf770d
Gerrit-Change-Number: 1193560
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193568?usp=email )
Change subject: [bugfix] finally reset messages in DeprecationTestCase.assertOneDeprecation
......................................................................
[bugfix] finally reset messages in DeprecationTestCase.assertOneDeprecation
Bug: T406428
Change-Id: I03cbae772e30c89460e4e546a8aaf6522e1292bb
---
M tests/aspects.py
1 file changed, 9 insertions(+), 7 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/aspects.py b/tests/aspects.py
index b691abc..e980ea9 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1666,13 +1666,15 @@
def assertOneDeprecation(self, msg=None, count=1) -> None:
"""Assert that exactly one deprecation message happened and reset."""
- self.assertDeprecation(msg)
- # This is doing such a weird structure, so that it shows any other
- # deprecation message from the set.
- self.assertCountEqual(set(self.deprecation_messages),
- [self.deprecation_messages[0]])
- self.assertLength(self.deprecation_messages, count)
- self._reset_messages()
+ try:
+ self.assertDeprecation(msg)
+ # This is doing such a weird structure, so that it shows any other
+ # deprecation message from the set.
+ self.assertCountEqual(set(self.deprecation_messages),
+ [self.deprecation_messages[0]])
+ self.assertLength(self.deprecation_messages, count)
+ finally:
+ self._reset_messages()
def assertNoDeprecation(self, msg=None) -> None:
"""Assert that no deprecation warning happened."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193568?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: I03cbae772e30c89460e4e546a8aaf6522e1292bb
Gerrit-Change-Number: 1193568
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot