瓶用JWT插件
bottlejwt的Python项目详细描述
瓶装水
瓶用JWT插件
安装
通过PIP:^{TT1}$
或克隆:git clone https://github.com/agalera/bottlejwt.git
示例服务器:
frombottleimportget,install,runfrombottlejwtimportJwtPlugindefvalidation(auth,auth_value):print(auth,auth_value)returnTrue@get("/",auth="any values and types")defexample(auth):# auth argument is optional!return"ok"install(JwtPlugin(validation,'secret',algorithm='HS256'))run(host="0.0.0.0",port="9988")
测试:
curl http://localhost:9988/?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
创建令牌:
frombottlejwtimportJwtPlugin# is a singleton, you only need to initialize once.# * If you did install () also workJwtPlugin(validation,'secret',algorithm='HS256')print(JwtPlugin.encode({'name':'pepito'}))
更改日志
0.0.13(11-01-2017)
- 通过pip修复安装包!
0.0.12(2017年1月6日)
- 将测试修复到Python2.6
0.0.11(2017年1月5日)
- 修复pypi中的兼容性列表
- 将python 3.6添加到travis中的测试中
0.0.10(2017年1月5日)
- 添加测试
- 特拉维斯积分
- 覆盖率100%
- 完全支持Python2.7和Pypy
0.0.9(2017年1月5日)
- 通过支持python 2(https://github.com/agalera/bottlejwt/pull/1) stryker250
0.0.1至0.0.8
- 初始版本