API talk:Client code/Evaluations/Pywikibot

From mediawiki.org
Latest comment: 9 years ago by Ladsgroup in topic Gzip and user-agent

Gzip and user-agent[edit]

@Fhocutt: Hello, As I know httplib2 automatically (without demanding explicitly implying in codes) compresses to gzip one example, and another thing is user-agent of pywikibot is completely okay the code. Why do you think there is a problem about them? Ladsgroup (talk) 11:13, 6 July 2014 (UTC)Reply[reply]

Thanks for the comment, Ladsgroup. I wasn't aware that httplib2 automatically handled gzip; I've changed that point in the evaluation. Re: the user agent, https://meta.wikimedia.org/wiki/User-agent_policy requires not just identifying the bot but also providing some way of contacting the person who is running it. Unless I am missing something, pywikibot does the first but not the second.
Thank you User:Fhocutt. So you are saying that we need to add username in the user-agent? Ladsgroup (talk) 23:50, 6 July 2014 (UTC)Reply[reply]
@Ladsgroup: That's probably easiest and works as long as the user is logged in (so, works fine for pywikibot). --Fhocutt (talk) 09:13, 7 July 2014 (UTC)Reply[reply]

On the gzip front, I have put up a patch which verifies that gzip is occurring behind the scenes in httplib2. John Vandenberg (talk) 00:45, 9 July 2014 (UTC)Reply[reply]

@John Vandenberg: I'm not familiar with the unittest module, but after looking at the code for a moment, I think in line 30 of that patch you want self.assertIsInstance and not self.assertTrue. (I don't have a Gerrit account or else I'd say something there. Jcgoble3 (talk) 01:08, 9 July 2014 (UTC)Reply[reply]
Much appreciated Jcgoble3; new version uploaded. (Signing up for a gerrit is quite easy, and it would be golden to have more reviewers helping bring the gold up to packaging quality). John Vandenberg (talk) 01:47, 9 July 2014 (UTC)Reply[reply]

There is an issue about user-agent User:Fhocutt. Usernames are in utf-8 but user-agent only supports ISO/IEC 8859-1 so even a č in user would returns error for every call (not considering non Latin user-names like درفش کاویانی or לערי ריינהארט). I thought about transliteration but I think it's returning False information. maybe we can rule that people need to have ISO 8859 compatible user name to run a botLadsgroup (talk) 17:33, 10 July 2014 (UTC)Reply[reply]

Good call, User:Ladsgroup. The important thing is that there be some means of contacting the bot-runner, so requiring an ISO 8859 compatible email address for users with non-Latin usernames is another possible solution. --Fhocutt (talk) 17:47, 10 July 2014 (UTC)Reply[reply]
We don't ask people to put their e-mail address into user-config.py. but I think we can do something about it. Ladsgroup (talk) 18:42, 10 July 2014 (UTC)Reply[reply]