Skip to main content

JWT plugin for bottle

Project description

pythonversions Codecov Travis


JWT plugin for bottle


Via pip: pip install bottlejwt

Or clone: git clone

example server:

from bottle import get, install, run
from bottlejwt import JwtPlugin

def validation(auth, auth_value):
    print(auth, auth_value)
    return True

@get("/", auth="any values and types")
def example(auth):  # auth argument is optional!
    return "ok"

install(JwtPlugin(validation, 'secret', algorithm='HS256'))
run(host="", port="9988")


curl http://localhost:9988/?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Create Token:

from bottlejwt import JwtPlugin

# is a singleton, you only need to initialize once.
# * If you did install () also work
JwtPlugin(validation, 'secret', algorithm='HS256')

print(JwtPlugin.encode({'name': 'pepito'}))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bottlejwt-1.0.1.tar.gz (3.9 kB view hashes)

Uploaded source

Built Distribution

bottlejwt-1.0.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page