jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1225074?usp=email )

Change subject: IMPR: Add user-agent to message if Non-JSON response received 
from server
......................................................................

IMPR: Add user-agent to message if Non-JSON response received from server

UA is responsible for some Non-JSON response.

Bug: T414170
Change-Id: I23dec15b3ef569e110020cd1492f1bdfa8952f2d
---
M pywikibot/data/api/_requests.py
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 419439e..9ec54dd 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -799,11 +799,13 @@
             text = removeDisabledParts(response.text, ['script'])
             text = re.sub('\n{2,}', '\n',
                           '\n'.join(removeHTMLParts(text).splitlines()[:20]))
+            ua = response.request.headers.get('User-Agent')
             msg = f"""\
 Non-JSON response received from server {self.site} for url
 {response.url}
 The server may be down.
 Status code: {response.status_code}
+User agent: {ua}

 The text message is:
 {text}

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1225074?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: I23dec15b3ef569e110020cd1492f1bdfa8952f2d
Gerrit-Change-Number: 1225074
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[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]

Reply via email to