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.5.tar.gz
(10.2 kB
view details)
Built Distributions
mwoauth-0.3.5-py3.5.egg
(26.5 kB
view details)
mwoauth-0.3.5-py3-none-any.whl
(13.4 kB
view details)
mwoauth-0.3.5-py2.7.egg
(25.9 kB
view details)
File details
Details for the file mwoauth-0.3.5.tar.gz
.
File metadata
- Download URL: mwoauth-0.3.5.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 | c7e4c56561a280e14ca4cc20b79ba4a9dd4ec752ff4c797cf29dad4460fb7832 |
|
MD5 | 058d6ef91f32bf9f1b338e36d422a134 |
|
BLAKE2b-256 | 6e990aeb23bc33268c45bca91fcd315c775955cde8b37ae014347dc1b0cb4f85 |
File details
Details for the file mwoauth-0.3.5-py3.5.egg
.
File metadata
- Download URL: mwoauth-0.3.5-py3.5.egg
- Upload date:
- Size: 26.5 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 | 6526245e8ce7cfb1b61678d37c338322c21783f05e7bed03c519c7df89378d71 |
|
MD5 | 9275443d881d9503bd7dba2d0343960b |
|
BLAKE2b-256 | 929928094792d924f39657b69992eafd9e854e3c03c5abf8780b5cadc0dad197 |
File details
Details for the file mwoauth-0.3.5-py3-none-any.whl
.
File metadata
- Download URL: mwoauth-0.3.5-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 | 65014797ce4c80d330fb630c1d04177bb073cd4f4cf30e005b8cbe345c2b9876 |
|
MD5 | f0cf6500b9886b8f6ad0d5823e7106fd |
|
BLAKE2b-256 | 8152b3415581eaa23703858a2225649c4c1fa656807050fccfedb8557a2afb7d |
File details
Details for the file mwoauth-0.3.5-py2.7.egg
.
File metadata
- Download URL: mwoauth-0.3.5-py2.7.egg
- Upload date:
- Size: 25.9 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 | 7ce935113b74702bd00907ed15c0eef83aa8cd7d0e41473eb5e216c088fce71f |
|
MD5 | 09c18c5ea1bc74fb5b9477e3c1e572be |
|
BLAKE2b-256 | caa7e8cd3947c877acd6fdfd45e64628b5f979aad1331b6690f39b31616fd5b3 |