barrust/mediawiki

Parameter to identify your client and follow the api etiquette.

inktrap opened this issue · 5 comments

I thought about is the api etiquette. Currently there are rate_limit and rate_limit_wait, but you can' set a header to identify your client. Perhaps other stuff is required by wikipedia too?

pymediawiki currently sets the browser user-agent string (user_agent) which allows up to follow the guidelines. It does default to signal that it is this library using the infrastructure but a user can change it to something else, if necessary.

Yes, but shouldn't the custom user agent be (a) an explicit setting/parameter and (b) be present in the examples? To quote from the docs above (emphasis mine):

Don't use the default User-Agent provided by your client library, but make up a custom header that identifies your script or service and provides some type of means of contacting you (e.g., an e-mail address).

I mean, shouldn't it be as easy as possible for the user to do this?

I didn't notice that language in the etiquette. Good catch! Do you think adding a user_agent parameter to the initialization would be sufficient? I can also add it to some of the documentation also.

Resolved by PR #53

Added initialization parameter and added documentation about setting the user-agent string. Thank you again for pointing this out!

Added to release 0.4.1 and uploaded it to pypi