-
-
Notifications
You must be signed in to change notification settings - Fork 16
[MediaWiki] Advanced usages
Private wikis are those wikis where anonymous users have no read access. This can cause problem for ordinary login procedure, because the client can virtually invoke nothing other than action=login
. To address the issue, you can use the alternative constructor signature to login to the wiki site before performing any other querying requests
public WikiSite(
IWikiClient wikiClient,
SiteOptions options,
string userName,
string password
)
As have mentioned in Getting Started page, you need to wait for the initialization to complete using await wikiSite.Initialization
, before proceeding with any other operations. If the login failed, you will receive the exception via Initialization
task.
In some cases, your MediaWiki site may be protected by certain HTTP authentication layer. To pass in the appropriate credential information, you need to use WikiClient(HttpMessageHandler handler)
constructor to initialize the WikiClient
. From here you have a chance to pass in your own HttpClientHandler
instance. Especially, you may implement ICredential
interface, and set HttpClientHandler.Credentials
to it. Then you can create WikiSite
instances from this WikiClient
.
You can get/set/persist cookies with WikiClient.CookieContainer
property.
The following APIs have also been taken or partially taken into the library
-
opensearch
: SeeWikiSite.OpenSearch
. -
parse
: SeeWikiSite.ParsePageAsync
,WikiSite.ParseRevisionAsync
, andWikiSite.ParseContentAsync
. There's also a demo inWpfTestApplication1
.
You can search for a valid MediaWiki entry point with WikiSite.SearchApiEndpointAsync
, given the URL of the website or the URL of a page on it. See UnitTestProject1.SiteTests.SearchApiEndpointTest
for example.
The following behavior has been implemented
- Request timeout and retry (
WikiClient
) - Throttle before edit/move/delete (
WikiSite.Throttler
)
The following behavior has yet to be implemented
- Detect {{inuse}}
- Detect {{bots}}, {{nobots}}
- You can use
WikiSite.InvokeMediaWikiApiAsync
to send your custom MediaWiki API request. This is almost the lowest-level method for invoking MediaWiki API.