Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mwclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebU
shared
mwclient
Commits
5d4ca88d
Commit
5d4ca88d
authored
1 year ago
by
Marc Troelitzsch
Committed by
Adam Williamson
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: #322 Update authentication method docs
parent
52f63c77
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/source/user/connecting.rst
+22
-16
22 additions, 16 deletions
docs/source/user/connecting.rst
with
22 additions
and
16 deletions
docs/source/user/connecting.rst
+
22
−
16
View file @
5d4ca88d
...
@@ -115,8 +115,8 @@ unauthenticated, just set
...
@@ -115,8 +115,8 @@ unauthenticated, just set
.. _oauth:
.. _oauth:
OAuth
OAuth
Authentication
^^^^^
^^^^^
^^^^^^^^^^^^^^^
On Wikimedia wikis, the recommended authentication method is to authenticate as
On Wikimedia wikis, the recommended authentication method is to authenticate as
a `owner-only consumer`_. Once you have obtained the *consumer token* (also
a `owner-only consumer`_. Once you have obtained the *consumer token* (also
...
@@ -132,33 +132,39 @@ called *consumer key*), the *consumer secret*, the *access token* and the
...
@@ -132,33 +132,39 @@ called *consumer key*), the *consumer secret*, the *access token* and the
.. _owner-only consumer: https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers
.. _owner-only consumer: https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers
.. _
old-login
:
.. _
username-password
:
Old-school logi
n
Username-Password Authenticatio
n
^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
To use old-school login, call the login method:
.. warning::
Username-Password authentication is not recommended for Wikimedia wikis.
See :ref:`oauth` for the recommended authentication method.
>>> site.login('my_username', 'my_password')
The easiest way to authenticate is to call :meth:`~mwclient.client.Site.login`
with your username and password. If login fails, a
:class:`mwclient.errors.LoginError` will be raised.
If login fails, a :class:`mwclient.errors.LoginError` will be thrown.
>>> site.login('my_username', 'my_password')
See :meth:`mwclient.client.Site.login` for all options.
.. _http-auth:
.. _http-auth:
HTTP authentication
HTTP authentication
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^
If your server is configured to use HTTP authentication, you can
.. warning::
authenticate using the ``httpauth`` parameter. For Basic HTTP authentication:
HTTP authentication does not replace MediaWiki's built-in authentication
system. It is used to protect access to the API, not to authenticate users.
>>> site = Site('awesome.site', httpauth=('my_username', 'my_password'))
If your server is configured to use HTTP authentication, you can authenticate
using the ``httpauth`` parameter. This parameter is a proxy to the
``auth`` parameter of :class:`requests.Session` and can be set to any class
that extends :class:`requests.auth.AuthBase`. For example, to use basic
authentication:
You can also pass in any other :ref:`authentication mechanis
m
<
requests
:
auth
entication>`
>>> fro
m requests
.
auth
import HTTPBasicAuth
based on the :class:`requests.auth.AuthBase`, such as Digest authentication:
>>> site = Site('awesome.site', httpauth=HTTPBasicAuth('my_username', 'my_password'))
>>> from requests.auth import HTTPDigestAuth
>>> site = Site('awesome.site', httpauth=HTTPDigestAuth('my_username', 'my_password'))
.. _ssl-auth:
.. _ssl-auth:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment