Redis Sesion Implementation for Naja Atra
This is the redis session implementation for the project naja atra
Usage
import naja_atra
import naja_atra.server as server
import os
from naja_atra_redis_session.redis_session import RedisSessionFactory
def main(*args):
# host, port, db, username, password are all optional.
naja_atra.set_session_factory(RedisSessionFactory(host="10.0.2.16", port=6379, db=0, username="", password=""))
server.scan("tests/ctrls", r'.*controllers.*')
root = os.path.dirname(os.path.abspath(__file__))
server.start(
port=9090,
resources={"/public/*": f"{root}/tests/static"})
or you can re-use your redis client which might be used in other codes.
import naja_atra
import naja_atra.server as server
import os
import redis
from naja_atra_redis_session.redis_session import RedisSessionFactory
def main(*args):
# This redis client can be used in other business codes.
redis_client = redis.Redis(host="10.0.2.16", port=6379, db=0, username="", password="")
naja_atra.set_session_factory(RedisSessionFactory(redis_client=redis_client))
root = os.path.dirname(os.path.abspath(__file__))
server.start(
port=9090,
resources={"/public/*": f"{root}/tests/static"})
Write Your Own ObjectSerializer
Module pickle is used to do the serialization and deserialization, if the defalut serialization logic could not satisfy you, you can write your own
naja_atra_redis_session.redis_session import ObjectSerializer
class MyObjectSerializer(ObjectSerializer):
def object_to_bytes(self, obj: Any) -> bytes:
bys = ...
return bys
def bytes_to_objects(self, value: bytes) -> Any:
obj = ...
return obj
# Set it when initializing a SessionFactory.
naja_atra.set_session_factory(RedisSessionFactory(host="10.0.2.16", port=6379, db=0, username="", password="", object_serializer=MyObjectSerializer()))
Metadata
Release files for naja-atra-redis-session 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 |
|---|---|---|---|---|
| naja-atra-redis-session-1.0.1.tar.gz | 4.2 kB | Without provenance | Details for naja-atra-redis-session-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| naja_atra_redis_session-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for naja_atra_redis_session-1.0.1-py3-none-any.whl |
Total release size: 10.7 kB
Release files / naja-atra-redis-session-1.0.1.tar.gz
| Download URL | naja-atra-redis-session-1.0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a523b6bee3af57ed9a87ac16c2b83090d132929d1de5314dff314feb32b25514
|
|
BLAKE2b-256 checksum How to use checksums |
1712a9203eda421bb11963a65fb22b1e973b77baf22c816fbadbe830469e25fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / naja_atra_redis_session-1.0.1-py3-none-any.whl
| Download URL | naja_atra_redis_session-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
311de0ea4d1af952a47e9b85ad3bcd413f3245c787bee6ad939b728bb276268a
|
|
BLAKE2b-256 checksum How to use checksums |
3e4a78f55251200f539eb43ed6450b6dfae866b84075b7fc09c56f9dec5155ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for naja-atra-redis-session 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.