mwoauth


Namemwoauth JSON
Version 0.3.8 PyPI version JSON
download
home_pagehttps://github.com/mediawiki-utilities/python-mwoauth
SummaryA generic MediaWiki OAuth handshake helper.
upload_time2022-05-24 16:03:00
maintainer
docs_urlhttps://pythonhosted.org/mwoauth/
authorAaron Halfaker / Filippo Valsorda
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements PyJWT requests requests-oauthlib six
Travis-CI
coveralls test coverage No coveralls.
            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 <https://www.mediawiki.org/wiki/Extension:OAuth>`_ installed.  

**Compatible with python 2.7 and 3.x**

**Install with pip:** ``pip install mwoauth``

**Documentation:** http://pythonhosted.org/mwoauth

Usage
=====

.. code-block:: python

	from mwoauth import ConsumerToken, Handshaker
	from six.moves import input # For compatibility between python 2 and 3

	# Construct 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))




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mediawiki-utilities/python-mwoauth",
    "name": "mwoauth",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/mwoauth/",
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Aaron Halfaker / Filippo Valsorda",
    "author_email": "aaron.halfaker@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/00/9b/a4e57553500ac5ecf513b49beb5ebccffae2a83a3ff4ec53b3f2acee6e41/mwoauth-0.3.8.tar.gz",
    "platform": null,
    "description": "MediaWiki OAuth Library\n=======================\n\n``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 <https://www.mediawiki.org/wiki/Extension:OAuth>`_ installed.  \n\n**Compatible with python 2.7 and 3.x**\n\n**Install with pip:** ``pip install mwoauth``\n\n**Documentation:** http://pythonhosted.org/mwoauth\n\nUsage\n=====\n\n.. code-block:: python\n\n\tfrom mwoauth import ConsumerToken, Handshaker\n\tfrom six.moves import input # For compatibility between python 2 and 3\n\n\t# Construct a \"consumer\" from the key/secret provided by MediaWiki\n\timport config\n\tconsumer_token = ConsumerToken(config.consumer_key, config.consumer_secret)\n\n\t# Construct handshaker with wiki URI and consumer\n\thandshaker = Handshaker(\"https://en.wikipedia.org/w/index.php\",\n\t                        consumer_token)\n\n\t# Step 1: Initialize -- ask MediaWiki for a temporary key/secret for user\n\tredirect, request_token = handshaker.initiate()\n\n\t# Step 2: Authorize -- send user to MediaWiki to confirm authorization\n\tprint(\"Point your browser to: %s\" % redirect) # \n\tresponse_qs = input(\"Response query string: \")\n\n\t# Step 3: Complete -- obtain authorized key/secret for \"resource owner\"\n\taccess_token = handshaker.complete(request_token, response_qs)\n\tprint(str(access_token))\n\n\t# Step 4: Identify -- (optional) get identifying information about the user\n\tidentity = handshaker.identify(access_token)\n\tprint(\"Identified as {username}.\".format(**identity))\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A generic MediaWiki OAuth handshake helper.",
    "version": "0.3.8",
    "project_urls": {
        "Homepage": "https://github.com/mediawiki-utilities/python-mwoauth"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e91a258e40d74281aefafa1e1b3258fa982ae5b9fd03b5ebbdb829076fecb0c9",
                "md5": "e83ab785caa189caeb7a55890c15b6be",
                "sha256": "0fe65bc42aa78f29da33df4c851d12e3b6c41820772bb51b18945f7ea710dca2"
            },
            "downloads": -1,
            "filename": "mwoauth-0.3.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e83ab785caa189caeb7a55890c15b6be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13299,
            "upload_time": "2022-05-24T16:02:58",
            "upload_time_iso_8601": "2022-05-24T16:02:58.578448Z",
            "url": "https://files.pythonhosted.org/packages/e9/1a/258e40d74281aefafa1e1b3258fa982ae5b9fd03b5ebbdb829076fecb0c9/mwoauth-0.3.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "009ba4e57553500ac5ecf513b49beb5ebccffae2a83a3ff4ec53b3f2acee6e41",
                "md5": "d02865fcded4ae8e736c6a05047d1210",
                "sha256": "08daf4edabaa0f95a845f98e5707de7316a8383a9625f20ae768b035991c36ac"
            },
            "downloads": -1,
            "filename": "mwoauth-0.3.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d02865fcded4ae8e736c6a05047d1210",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10536,
            "upload_time": "2022-05-24T16:03:00",
            "upload_time_iso_8601": "2022-05-24T16:03:00.929675Z",
            "url": "https://files.pythonhosted.org/packages/00/9b/a4e57553500ac5ecf513b49beb5ebccffae2a83a3ff4ec53b3f2acee6e41/mwoauth-0.3.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-05-24 16:03:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mediawiki-utilities",
    "github_project": "python-mwoauth",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "PyJWT",
            "specs": [
                [
                    "==",
                    "2.4.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.21.0"
                ]
            ]
        },
        {
            "name": "requests-oauthlib",
            "specs": [
                [
                    "==",
                    "1.2.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.12.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "mwoauth"
}
        
Elapsed time: 0.10609s