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.3.tar.gz
(9.5 kB
view details)
Built Distributions
mwoauth-0.3.3-py3.5.egg
(26.2 kB
view details)
mwoauth-0.3.3-py3-none-any.whl
(13.2 kB
view details)
mwoauth-0.3.3-py2.7.egg
(25.7 kB
view details)
File details
Details for the file mwoauth-0.3.3.tar.gz
.
File metadata
- Download URL: mwoauth-0.3.3.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8a57a315732733240e9522d3c4e370cbdf2c045d00fe0dab433d6119fa09038f
|
|
MD5 |
11e74d2d25a0e24074b6cb909270d19b
|
|
BLAKE2b-256 |
a84d041823727dd274d5d8e64ef6a3c8d856bb50839d3f207cb66fcc77e61900
|
File details
Details for the file mwoauth-0.3.3-py3.5.egg
.
File metadata
- Download URL: mwoauth-0.3.3-py3.5.egg
- Upload date:
- Size: 26.2 kB
- Tags: Egg
- 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 |
4a96f2ffcb08c8ed727f3a3f1aa1e8c661abd8cb6bb3068faeb0a3a035df3ed1
|
|
MD5 |
387797a4387f279b32668321e5214737
|
|
BLAKE2b-256 |
c3f98efd37f90ae00ea7fb9f5aa92e4f87ec45f3c12ffe9bd263dc66c81a5da0
|
File details
Details for the file mwoauth-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: mwoauth-0.3.3-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ae0d094bd8817b690af5e8c52a113ae229e689fca59303aae0f0fdfb0ca911d1
|
|
MD5 |
6695bb7e854c36677c17a938f0d55f76
|
|
BLAKE2b-256 |
0a132026e54ad40e700f3baae95f15321ad224dab3ea9e82b67595708e85363c
|
File details
Details for the file mwoauth-0.3.3-py2.7.egg
.
File metadata
- Download URL: mwoauth-0.3.3-py2.7.egg
- Upload date:
- Size: 25.7 kB
- Tags: Egg
- 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 |
d54d18dca8291a2bef72e72f8d1858e744998375f80caba4c2edb75be588c599
|
|
MD5 |
53d626bf4e916e9cfcb4ba4793ceb6bb
|
|
BLAKE2b-256 |
04c58f37c8d48a649146cdd05740daf1774117c9b5b42d8769ac4b8cffce18df
|