Errors

exception mwclient.errors.APIDisabledError[source]

Bases: MwClientError

The API is disabled on the wiki.

exception mwclient.errors.APIError(code, info, kwargs)[source]

Bases: MwClientError

Base class for errors returned by the MediaWiki API.

Parameters:
  • code (str | None)

  • info (str)

  • kwargs (Any | None)

Return type:

None

code

The error code returned by the API.

Type:

Optional[str]

info

The error message returned by the API.

Type:

str

kwargs

Additional information.

Type:

Optional[Any]

exception mwclient.errors.AssertUserFailedError[source]

Bases: MwClientError

Raised when the user assertion fails.

Return type:

None

exception mwclient.errors.EditError[source]

Bases: MwClientError

Base class for errors related to editing pages.

exception mwclient.errors.EmailError[source]

Bases: MwClientError

Base class for email errors.

exception mwclient.errors.FileExists(file_name)[source]

Bases: EditError

Raised when trying to upload a file that already exists.

See also: https://www.mediawiki.org/wiki/API:Upload#Upload_warnings

Parameters:

file_name (str)

Return type:

None

file_name

The name of the file that already exists.

Type:

str

exception mwclient.errors.InsufficientPermission[source]

Bases: MwClientError

Raised when the user does not have sufficient permissions to perform an action.

exception mwclient.errors.InvalidPageTitle[source]

Bases: MwClientError

Raised when an invalid page title is used.

exception mwclient.errors.InvalidResponse(response_text=None)[source]

Bases: MwClientError

Raised when the server returns an invalid JSON response.

Parameters:

response_text (str | None)

Return type:

None

response_text

The response text from the server.

Type:

str

exception mwclient.errors.LoginError(site, code, info)[source]

Bases: MwClientError

Base class for login errors.

Parameters:
Return type:

None

site

The site object on which the login attempt was made.

Type:

mwclient.site.Site

code

The error code returned by the API.

Type:

str

info

The error message returned by the API.

Type:

str

exception mwclient.errors.MaximumRetriesExceeded[source]

Bases: MwClientError

The maximum number of retries for a request has been exceeded.

exception mwclient.errors.MediaWikiVersionError[source]

Bases: MwClientError

The version of MediaWiki is not supported.

exception mwclient.errors.MwClientError[source]

Bases: RuntimeError

Base class for all mwclient errors.

exception mwclient.errors.NoSpecifiedEmail[source]

Bases: EmailError

Raised when trying to email a user who has not specified an email

exception mwclient.errors.OAuthAuthorizationError(site, code, info)[source]

Bases: LoginError

Raised when OAuth authorization fails.

Parameters:
Return type:

None

site

The site object on which the login attempt was made.

Type:

mwclient.site.Site

code

The error code returned by the API.

Type:

str

info

The error message returned by the API.

Type:

str

exception mwclient.errors.ProtectedPageError(page, code=None, info=None)[source]

Bases: EditError, InsufficientPermission

Raised when attempting to edit a protected page.

Parameters:
Return type:

None

page

The page for which the edit attempt was made.

Type:

mwclient.page.Page

code

The error code returned by the API.

Type:

Optional[str]

info

The error message returned by the API.

Type:

Optional[str]

exception mwclient.errors.UserBlocked[source]

Bases: InsufficientPermission

Raised when attempting to perform an action while blocked.