Sanic Api Key
Basic support for API Keys. Support form, args, header.
Installion
pip install sanicapikey
Example Usage
from sanic import Sanic
from sanic.response import text, json
from SanicApiKey import SanicApiKey
app = Sanic('test')
async def test(request):
return json({ "error": 'invalid api key' })
auth = SanicApiKey(app, 'api_key', keys=['hello', 'world'], error=test)
# Header:
# auth = SanicApiKey(app, header='api_key', keys=['hello', 'world'], error=test)
# Form
# auth = SanicApiKey(app, form='api_key', keys=['hello', 'world'], error=test)
@app.route('/')
@auth.key_required
async def test(request):
return json({'success': True, 'key': auth.get_token()})
if __name__ == '__main__':
app.run(host='localhost', port=8000)
Metadata
Release files for SanicApiKey 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| SanicApiKey-1.0.1.tar.gz | 2.4 kB | Without provenance | Details for SanicApiKey-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| SanicApiKey-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for SanicApiKey-1.0.1-py3-none-any.whl |
Total release size: 4.8 kB
Release files / SanicApiKey-1.0.1.tar.gz
| Download URL | SanicApiKey-1.0.1.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5dd42c5dbb9fc538812dae1f5c1d689a54df31829987f5e603e676df457f71c
|
|
BLAKE2b-256 checksum How to use checksums |
0a87db50850b972ef83884d4d9b12176577c1322dde53d250b096a3102d2f58d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
|
Release files / SanicApiKey-1.0.1-py3-none-any.whl
| Download URL | SanicApiKey-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bae9893892763381d1c73ae9ead3ad2135b4134cdd577cb799d402c7459e21e3
|
|
BLAKE2b-256 checksum How to use checksums |
d9172560f86822d244bc5a056b107f2076b77fc2817f6f63358a8b831cccfe87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
|
Security for SanicApiKey 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.