sanic-redis
Redis support for sanic.
Built on top of aioredis.
Installation
You can install this package as usual with pip:
pip install sanic-redis-extend
Config
For example:
redis://[[username]:[password]]@localhost:6379/0
rediss://[[username]:[password]]@localhost:6379/0
unix://[[username]:[password]]@/path/to/socket.sock?db=0
Example
from sanic import Sanic
from sanic.response import text
from sanic_redis_extend import SanicRedisExtend
app = Sanic(__name__)
app.config.update(
{
'REDIS': "redis://default:xxx@127.0.0.1:6379/1",
}
)
redis = SanicRedisExtend()
redis.init_app(app)
@app.route('/')
async def test3(request):
# request.app.ctx.{redis_name}, the {redis_name} == config_name.lower()
async with request.app.ctx.redis as r:
await r.set('key1', 'value1')
result = await r.get('key1')
return text(str(result))
if __name__ == '__main__':
app.run()
Metadata
Release files for sanic-redis-extend 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sanic_redis_extend-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for sanic_redis_extend-0.0.1-py3-none-any.whl |
Release files / sanic_redis_extend-0.0.1-py3-none-any.whl
| Download URL | sanic_redis_extend-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
981d6f30eb8d2ee7e6bbf5893bb95ea675456a3a9d7fe3b51bbeb97b14bde1ea
|
|
BLAKE2b-256 checksum How to use checksums |
8829ac1b04ba7ddfb209af9a68ab7020128312539b00c62b5582388ba5225b3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.4rc1
|
Security for sanic-redis-extend 0.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.