A generic MediaWiki OAuth handshake helper.
Project description
MediaWiki OAuth Library
mwoauth is an open licensed (MIT) library designed to provide a simple means to performing an OAuth handshake with a MediaWiki installation with the OAuth Extension installed.
Compatible with python 2.7 and 3.x
Install with pip: pip install mwoauth
Documentation: http://pythonhosted.org/mwoauth
Usage
from mwoauth import ConsumerToken, Handshaker
from six.moves import input # For compatibility between python 2 and 3
# Consruct a "consumer" from the key/secret provided by MediaWiki
import config
consumer_token = ConsumerToken(config.consumer_key, config.consumer_secret)
# Construct handshaker with wiki URI and consumer
handshaker = Handshaker("https://en.wikipedia.org/w/index.php",
consumer_token)
# Step 1: Initialize -- ask MediaWiki for a temporary key/secret for user
redirect, request_token = handshaker.initiate()
# Step 2: Authorize -- send user to MediaWiki to confirm authorization
print("Point your browser to: %s" % redirect) #
response_qs = input("Response query string: ")
# Step 3: Complete -- obtain authorized key/secret for "resource owner"
access_token = handshaker.complete(request_token, response_qs)
print(str(access_token))
# Step 4: Identify -- (optional) get identifying information about the user
identity = handshaker.identify(access_token)
print("Identified as {username}.".format(**identity))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mwoauth-0.3.6.tar.gz
(10.2 kB
view details)
Built Distributions
mwoauth-0.3.6-py3.5.egg
(26.2 kB
view details)
mwoauth-0.3.6-py3-none-any.whl
(13.4 kB
view details)
mwoauth-0.3.6-py2.7.egg
(25.6 kB
view details)
mwoauth-0.3.6-py2-none-any.whl
(14.2 kB
view details)
File details
Details for the file mwoauth-0.3.6.tar.gz
.
File metadata
- Download URL: mwoauth-0.3.6.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068f62c13a7bdf0865156e539e132ae4cb5abac0b6a69a9a613ef6a4d99e34b0 |
|
MD5 | 2f1a9e7ceab665d174c767b4354bad00 |
|
BLAKE2b-256 | d9436773d237964b75115c0f17f053d67698d08d30847eb5a9ee181a694d97c5 |
File details
Details for the file mwoauth-0.3.6-py3.5.egg
.
File metadata
- Download URL: mwoauth-0.3.6-py3.5.egg
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ec86ae115c62b4477f86c161d33e1ad5513f2c0c8e141cef84d03d1f21d8b9d |
|
MD5 | bd35384003d09cb5c496bb1777a6828b |
|
BLAKE2b-256 | 479b70ee40ba2434d4800308f422aa638a674e3a6c44a5b09d3db4729788b86e |
File details
Details for the file mwoauth-0.3.6-py3-none-any.whl
.
File metadata
- Download URL: mwoauth-0.3.6-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59c80dd286893539b71ae23c1c1e114c5ad25015a6ce7111122570e2bfc4934f |
|
MD5 | 241091595622b609040d6c55a3a47e78 |
|
BLAKE2b-256 | 014e86660e3b0479551b3bb1d21ab57f3865ef0d3a3c436f3a57b4ed0e1de9c1 |
File details
Details for the file mwoauth-0.3.6-py2.7.egg
.
File metadata
- Download URL: mwoauth-0.3.6-py2.7.egg
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdd6e7ef28446038f29d1abefda6eade4c07b1d32ea2125984c706fddbb87bdb |
|
MD5 | e68fa0370a921dd054d26b7f131c4646 |
|
BLAKE2b-256 | 123e38e241125bc9ed6ba6bfb204278da6ee67c00ee00f737fd19fdbb657667b |
File details
Details for the file mwoauth-0.3.6-py2-none-any.whl
.
File metadata
- Download URL: mwoauth-0.3.6-py2-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52712dbf6ba64784b35c6c710683480bc3e5ea3911f4201782c4bb719648994a |
|
MD5 | f3e93ab3df76ec3559a92c3ecb1d277e |
|
BLAKE2b-256 | 1f4ef3608718a401e6ceb52a2f5e443464a7e3bee49c5a11807610cd7f65a11e |