Skip to main content

Flask blueprint to connect to a MediaWiki OAuth server

Project description

https://pypip.in/v/flask-mwoauth/badge.png https://pypip.in/d/flask-mwoauth/badge.png

Flask blueprint to run OAuth against MediaWiki’s extension:OAuth.

The blueprint adds these uris:
  • /login - runs the OAuth handshake and returns the user to /

    • /login?next=/someurl will return the user to /someurl

  • /logout - clears the users’ access tokens

    • /logout?next=/someurl will return the user to /someurl

  • /oauth-callback - callback from MW to finish the handshake

The users’ OAuth key and secret are stored in the session.

In addition, flask-mwoauth adds a few convenience functions:
  • get_current_user(cached=True) reports who the current user is. To confirm the user is still logged in (e.g. tokens have not been revoked), call it with cached=False.

  • request(api_query) submits an request through the API, using the users’ access tokens. E.g. the current user request runs request({‘action’: ‘query’, ‘meta’: ‘userinfo’}).

An example app is implemented in demo.py.

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

flask-mwoauth-0.1.37.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file flask-mwoauth-0.1.37.tar.gz.

File metadata

File hashes

Hashes for flask-mwoauth-0.1.37.tar.gz
Algorithm Hash digest
SHA256 ac7835b1cac35731d9a47fb0e2585a03ab9284860de9a4ccf231a17243554e8d
MD5 b7f8b421c777b9c306efbca5be4df575
BLAKE2b-256 901667722e329e1f4627ddab71370623942d2291b9de6c50d9c8b44c23fdaea2

See more details on using hashes here.

Supported by

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