kanasimi / wikiapi

JavaScript MediaWiki API for node.js
https://kanasimi.github.io/wikiapi/
BSD 3-Clause "New" or "Revised" License
47 stars 5 forks source link

Provide an option to set a custom User-Agent string #65

Closed strefethen closed 1 year ago

strefethen commented 1 year ago

I can't seem to find a decent place to change the default User-Agent used in the library. Wikipedia has a User-Agent policy which calls for a specific User-Agent string and it would be great if there were an option to provide a custom User-Agent which was specific to the calling application vs. the wikiapi package.

Regards, Steve

kanasimi commented 1 year ago

By default, the library will use the user agent get_URL_node.default_user_agent set in Ajax.js. If you want to set another user agent, you can change CeL.wiki.query.get_URL_options listed in query.js:

CeL.wiki.query.get_URL_options.headers['User-Agent'] = 'testbot/1.0';
strefethen commented 1 year ago

Thank you!!

strefethen commented 1 year ago

@kanasimi any timeline for an updated release to NPM?

kanasimi commented 1 year ago

I'm still testing new features, so please wait some days.