Skip to main content

JWT plugin for bottle

Project description

pythonversions Codecov Travis

bottlejwt

JWT plugin for bottle

installation

Via pip: pip install bottlejwt

Or clone: git clone https://github.com/agalera/bottlejwt.git

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="0.0.0.0", port="9988")

Test:

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'}))

CHANGELOG

0.0.13 (11-01-2017)

  • Fix install package via pip!

0.0.12 (06-01-2017)

  • Fix tests to python 2.6

0.0.11 (05-01-2017)

  • Fix compatibility list in pypi

  • Add python 3.6 to tests in travis

0.0.10 (05-01-2017)

  • Add tests

  • Travis integration

  • Coverage 100%

  • Full support python 2.7 and Pypy

0.0.9 (05-01-2017)

0.0.1 to 0.0.8

  • Initial version

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

bottlejwt-0.0.15.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file bottlejwt-0.0.15.tar.gz.

File metadata

  • Download URL: bottlejwt-0.0.15.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5

File hashes

Hashes for bottlejwt-0.0.15.tar.gz
Algorithm Hash digest
SHA256 0f38d0f1869e2061952c7ed8492b2796e3a4796840259ceadf119b3a29e7dbee
MD5 c79d16aed32d7ae4aa524f2b3b891344
BLAKE2b-256 2264fc4c98bf1d07ed3e6a8e60b789083e5016edcd6489011ccb88a4012d9b10

See more details on using hashes here.

Supported by

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