https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
Web browser: --- Bug ID: 55016 Summary: Extended version information in user-agent Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/feature-requests/330/ Reported by: valhallasw Created on: 2013-02-04 20:52:53 Subject: Extended version information in user-agent Original description: See the discussion at https://www.mediawiki.org/wiki/Special:Code/pywikipedia/11027%5C#c33303
Implementation notes:
Hash of a file: >>> import hashlib >>> m = hashlib.sha1() >>> m.hexdigest() '93ae86148e74a7c3a3d63f7810b48c51889fba46'
Classes used in stack trace:
>> import inspect >> [(x.__module__, x.__name__) for x in (s[0].f_locals.get('self', None).__class__ for s in inspect.stack())]
Example result: [('wikipedia_family', 'Family'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('wikipedia_family', 'Family'), ('wikipedia', 'Site'), ('wikipedia', 'Site'), ('wikipedia', 'Site'), ('wikipedia', 'Site'), ('wikipedia', 'Site'), ('wikipedia', 'Page'), ('wikipedia', 'Page'), ('__main__', 'Subject'), ('__main__', 'Subject'), ('__main__', 'InterwikiBot'), ('__main__', 'InterwikiBot'), ('__builtin__', 'NoneType'), ('__builtin__', 'NoneType'), ('__builtin__', 'NoneType'), ('pdb', 'Pdb'), ('pdb', 'Pdb'), ('__builtin__', 'NoneType'), ('__builtin__', 'NoneType'), ('__builtin__', 'NoneType'), ('__builtin__', 'NoneType')]
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/feature-reque | |sts/330
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |Normal CC| |jayvdb@gmail.com, | |valhallasw@arctus.nl Version|unspecified |core (2.0)
--- Comment #1 from John Mark Vandenberg jayvdb@gmail.com --- In July there were three threads of discussion about user-agents for bots.
http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/78356
http://lists.wikimedia.org/pipermail/pywikipedia-l/2014-July/008924.html
http://lists.wikimedia.org/pipermail/pywikipedia-l/2014-July/008932.html
Following that Amir did some work to allow customisation of the user-agent, specifically adding site based information (https://gerrit.wikimedia.org/r/#/c/147381/), and I've put up a patch to allow the user agent functionality to be usable in more circumstances and be tested more easily. https://gerrit.wikimedia.org/r/#/c/152200/
As it is now a customisable string, it is possible to add email addresses, links to bot approvals, etc, etc. And lightly documented at
https://www.mediawiki.org/wiki/Manual:Pywikibot/User-agent
During the discussions I suggested something like what this bug is about: Identifying what code is running, is it the 'maintainer' version or customised by the bot operator, and putting that in the useragent.
http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/78363 http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/78413
In an IRC discussion with valhallasw, I suggested that we include the contact details of the maintainers of the running script, which can be parsed from the script docstring.
So, currently pywikibot _has_ the commit hash, sequential pywikibot revision, and
It only puts the sequential pywikibot revision into the user-agent, in the variable {version}. The sequential pywikibot revision is only a good reference point, but the running code could be different.
The commit hash is (almost) useless for ops staff, as it frequently changes.
The $Rev$ for each file that is checked in is more granular, but that doesnt help if the script file is modified or isnt checked in.
If I understand this enhancement request, it is suggesting that we get a hash of some/all of module that are used by the running script, and include that in the user-agent.
IMO, the first step is to get a hash for the script/module executed on the command line. This hash will change less frequently, and will often be common even for different branches of pywikibot. If the file is unmodified, I suggest we keep the existing user-agent value for {script}/{version}, which has a version prefix of 'g' and 's' for git or subversion. If the file is modified, I suggest we put the file hash in {version}, with a different prefix - e.g. 'm69789e1' where 'm' is for 'modified'.
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
--- Comment #2 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 152200 had a related patch set uploaded by John Vandenberg: User-agent graceful degradation
https://gerrit.wikimedia.org/r/152200
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
--- Comment #3 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 152200 merged by jenkins-bot: User-agent graceful degradation
https://gerrit.wikimedia.org/r/152200
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |NEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
Sorawee Porncharoenwase nullzero.free@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nullzero.free@gmail.com
--- Comment #4 from Sorawee Porncharoenwase nullzero.free@gmail.com --- @John Mark Vandenberg: Is the bug fixed?
https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
--- Comment #5 from John Mark Vandenberg jayvdb@gmail.com --- Not yet. We would like to add maintainer details to the user agent, where the maintainer can be different for each script, and would be obtained via a module variable __maintainer__ or similar.
pywikipedia-bugs@lists.wikimedia.org