Flask Google App Engine Users
Provide route decorators for Google App Engine users.
Author
Daniel 'Vector' Kerr (vector@vector.id.au)
License
Refer to LICENSE.txt.
Installation
pip install flask-gae-users
Sample Usage
Python Code
main.py
from flask import Flask, request, Response, jsonify
from flask_gae_users import GAEUsers
from flask_gae_users import GAENoUserException
from flask_gae_users import GAENotAdminException
app = Flask()
GAEUsers( app = app )
# Provide a response when a user is not logged in
@app.errorhandler( GAENoUserException )
def onAppNoUser( e ):
body = "<p>You must log in to continue</p>"
body = body + "<p><a href=\"" + app.get_login_url() + "\">Sign in</a></p>"
return Response( body, status = 401 )
# Provide a response when a user is not an administrator
@app.errorhandler( GAENotAdminException )
def onAppNoUser( e ):
body = "<p>You are not authorized to access this resource</p>"
body = body + "<p><a href=\"" + app.get_logout_url() + "\">Sign in as a different user</a></p>"
return Response( body, status = 403 )
# Create a user-protected route by adding the `require_user` decorator
@app.route( '/home', methods = [ 'GET' ] )
@app.require_user()
def routeHome():
user = app.get_user()
return jsonify( { 'user': repr( user ) } )
# Create an admin-protected route by adding the `require_admin` decorator
@app.route( '/admin', methods = [ 'GET' ] )
@app.require_admin()
def routeAdmin():
admin = app.get_user()
return jsonify( { 'admin': repr( admin ) } )
# Run the flask application
if __name__ == '__main__':
app.run( port = 8080 )
Run Server
python main.py
Metadata
Release files for flask-gae-users 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask-gae-users-0.0.1.tar.gz | 2.5 kB | Without provenance | Details for flask-gae-users-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_gae_users-0.0.1-py2-none-any.whl | Python 2 | none | any | Details for flask_gae_users-0.0.1-py2-none-any.whl |
Total release size: 5.4 kB
Release files / flask-gae-users-0.0.1.tar.gz
| Download URL | flask-gae-users-0.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2938e141b1b4e84119a6b99b02aada9a342ffaf9dbfc89606851193b2f48b711
|
|
BLAKE2b-256 checksum How to use checksums |
981653b111ff5461f88fa3ed7848034f3b03efe7e316a838d78c77ed63a06f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / flask_gae_users-0.0.1-py2-none-any.whl
| Download URL | flask_gae_users-0.0.1-py2-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
2248b55d74cbd7746be58e9d33159a9b5a214c69614bac8318630dfccec0fd18
|
|
BLAKE2b-256 checksum How to use checksums |
9c350ce794a96f2c68e9550198c57aeac11f71bc79f591bf31abe701e00c0736
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for flask-gae-users 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.