Skip to main content

aiohttp basic auth middleware.

Project description

HTTP basic authentication middleware for aiohttp.

Parameters

def bam_factory(login, password, bypass_ws=False)

创建一个basic auth的middleware

login:

username

password:

password

bypass_ws:

绕过websocket请求,默认为Flase,不绕过

Usage

# server_simple.py
from aiohttp import web
from aiohttp_bam import bam_factory


async def handle(request):
    return web.Response(text="Hello")


app = web.Application(middlewares=[bam_factory('your username', 'your password')])
app.add_routes([web.get("/", handle)])

web.run_app(app)

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

aiohttp-bam-0.0.2.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file aiohttp-bam-0.0.2.tar.gz.

File metadata

  • Download URL: aiohttp-bam-0.0.2.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for aiohttp-bam-0.0.2.tar.gz
Algorithm Hash digest
SHA256 78ccf70a450b8d9cdcbe124c9ea2ed65ddcbc0a4a8ddc384c5009d2011af6d02
MD5 a089e20b52be0c76e5f81d6de393c280
BLAKE2b-256 e05d628ef1b210e328c2f45c6aabe9c1708f51d464f81b7eb19968a144a2c940

See more details on using hashes here.

Supported by

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