Skip to main content

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


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.2.5.tar.gz (5.8 kB view details)

Uploaded Source

Built Distributions

mwoauth-0.2.5-py3.4.egg (13.2 kB view details)

Uploaded Egg

mwoauth-0.2.5-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file mwoauth-0.2.5.tar.gz.

File metadata

  • Download URL: mwoauth-0.2.5.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mwoauth-0.2.5.tar.gz
Algorithm Hash digest
SHA256 b77748ec3c1eca4b11dbdad07c47a263de0937451aefa897f53583e06297ad5e
MD5 5994f738669a96c0978f20d2342a3270
BLAKE2b-256 1ccad8c7de5c5934125f27915a9c2864e84762adaabdd6daf25c0c38db9aa922

See more details on using hashes here.

File details

Details for the file mwoauth-0.2.5-py3.4.egg.

File metadata

  • Download URL: mwoauth-0.2.5-py3.4.egg
  • Upload date:
  • Size: 13.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

Hashes for mwoauth-0.2.5-py3.4.egg
Algorithm Hash digest
SHA256 373e69f6d86430f469e3b90544cb1d794ca34fe4d0bd5f9310f95eafade681f4
MD5 bd35da3e632a313fa739091f860cb456
BLAKE2b-256 07fae7f8d265f630224ec0bd2a3c39b2fafeed958da3324a1e01c6c9c4dc6495

See more details on using hashes here.

File details

Details for the file mwoauth-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mwoauth-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 febd82be4f877450f15705039f1da712a6e7688ca2bb41a12b90c6626f677cc1
MD5 817e7f0d889df2c804426e42c10db3b1
BLAKE2b-256 96c806e717bd063c6befebfb79bc0b10c3c88144132be1ef3d17add78f2fed25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page