All Projects → hzlmn → aiohttp-jwt

hzlmn / aiohttp-jwt

Licence: MIT License
aiohttp middleware and helper utils for working with JSON web token.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to aiohttp-jwt

python-logi-circle
Python 3.6+ API for Logi Circle cameras
Stars: ✭ 23 (-67.14%)
Mutual labels:  aiohttp, asyncio
stream video server
demonstrates how to create video streaming server with the help of aiohttp and opencv
Stars: ✭ 15 (-78.57%)
Mutual labels:  aiohttp, asyncio
python3-concurrency
Python3爬虫系列的理论验证,首先研究I/O模型,分别用Python实现了blocking I/O、nonblocking I/O、I/O multiplexing各模型下的TCP服务端和客户端。然后,研究同步I/O操作(依序下载、多进程并发、多线程并发)和异步I/O(asyncio)之间的效率差别
Stars: ✭ 49 (-30%)
Mutual labels:  aiohttp, asyncio
trellio
Python3 asyncio based microframework for microservice architecture
Stars: ✭ 19 (-72.86%)
Mutual labels:  aiohttp, asyncio
feedsearch-crawler
Crawl sites for RSS, Atom, and JSON feeds.
Stars: ✭ 23 (-67.14%)
Mutual labels:  aiohttp, asyncio
yutto
🧊 一个可爱且任性的 B 站视频下载器(bilili V2)
Stars: ✭ 383 (+447.14%)
Mutual labels:  aiohttp, asyncio
netunnel
A tool to create network tunnels over HTTP/S written in Python 3
Stars: ✭ 19 (-72.86%)
Mutual labels:  aiohttp, asyncio
Arsenic
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Stars: ✭ 209 (+198.57%)
Mutual labels:  aiohttp, asyncio
fbemissary
A bot framework for the Facebook Messenger platform, built on asyncio and aiohttp
Stars: ✭ 30 (-57.14%)
Mutual labels:  aiohttp, asyncio
pyladies-courseware
Homework/task submit and review web app · based on React and Python aiohttp
Stars: ✭ 14 (-80%)
Mutual labels:  aiohttp, asyncio
aioneo4j
asyncio client for neo4j
Stars: ✭ 29 (-58.57%)
Mutual labels:  aiohttp, asyncio
dvhb-hybrid
A package to mix django and asyncio in one application
Stars: ✭ 45 (-35.71%)
Mutual labels:  aiohttp, asyncio
aioScrapy
基于asyncio与aiohttp的异步协程爬虫框架 欢迎Star
Stars: ✭ 34 (-51.43%)
Mutual labels:  aiohttp, asyncio
pytest-aiohttp
pytest plugin for aiohttp support
Stars: ✭ 110 (+57.14%)
Mutual labels:  aiohttp, asyncio
Tokio
Asyncio event loop written in Rust language
Stars: ✭ 236 (+237.14%)
Mutual labels:  aiohttp, asyncio
tomodachi
💻 Microservice library / framework using Python's asyncio event loop with full support for HTTP + WebSockets, AWS SNS+SQS, RabbitMQ / AMQP, middleware, etc. Extendable for GraphQL, protobuf, gRPC, among other technologies.
Stars: ✭ 170 (+142.86%)
Mutual labels:  aiohttp, asyncio
Create Aio App
The boilerplate for aiohttp. Quick setup for your asynchronous web service.
Stars: ✭ 207 (+195.71%)
Mutual labels:  aiohttp, asyncio
Python Mocket
a socket mock framework - for all kinds of socket animals, web-clients included
Stars: ✭ 209 (+198.57%)
Mutual labels:  aiohttp, asyncio
aiohttp-mako
mako template renderer for aiohttp.web
Stars: ✭ 32 (-54.29%)
Mutual labels:  aiohttp, asyncio
glQiwiApi
The ultrarapid and multifunctional wrapper over QIWI and YooMoney
Stars: ✭ 44 (-37.14%)
Mutual labels:  aiohttp, asyncio

aiohttp-jwt

Downloads Build Status codecov

The library provides aiohttp middleware and helper utils for working with JSON web tokens.

  • Works on Python3.5+
  • MIT License
  • Latest docs TBD
  • Contributions are highly welcome!

Requirements

Install

$ pip install aiohttp_jwt

Simple Usage

server.py

import jwt
from aiohttp import web

from aiohttp_jwt import JWTMiddleware

sharable_secret = 'secret'


async def protected_handler(request):
    return web.json_response({'user': request['payload']})


app = web.Application(
    middlewares=[
        JWTMiddleware(sharable_secret),
    ]
)

app.router.add_get('/protected', protected_handler)

if __name__ == '__main__':
    web.run_app(app)

client.py

import asyncio

import aiohttp
import async_timeout


async def fetch(session, url, headers=None):
    async with async_timeout.timeout(10):
        async with session.get(url, headers=headers) as response:
            return await response.json()


async def main():
    async with aiohttp.ClientSession() as session:
        response = await fetch(
            session,
            'http://localhost:8080/protected',
            headers={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRlc3QifQ.pyNsXX_vNsUvdt6xu13F1Gs1zGELT4Va8a38eG5svBA'})
        print(response)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Examples

Credits

This module inspired by official auth0/express-jwt middleware and express-jwt-permissions extension.

Related packages

For advanced security facilities check aio-libs/aiohttp_security

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].