jenkins-bot has submitted this change and it was merged.
Change subject: Fixup user_agent patch ......................................................................
Fixup user_agent patch
Change-Id: I60014b97b605439c46b0eec730f15aea568845db --- M pywikibot/comms/http.py 1 file changed, 4 insertions(+), 2 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index d8adef3..73b3c70 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -144,11 +144,13 @@ baseuri = urlparse.urljoin("%(proto)s://%(host)s" % locals(), uri) else: baseuri = uri - + username = site.username() + if not username: + username = "" kwargs["headers"]["user-agent"] = config.USER_AGENT_FORMAT.format( script=pywikibot.calledModuleName(), version=pywikibot.version.getversiondict()['rev'], - username=quote(site.username()), + username=quote(username), lang=site.lang, family=site.family.name) request = threadedhttp.HttpRequest(baseuri, *args, **kwargs)
pywikibot-commits@lists.wikimedia.org