Used to encode or decode data in a web-friendly format.
Project description
Web Encoder
Used to encode and decode data in a web-friendly format.
It's only uses building libraries, therefore, it has no external dependency. It is also lightweight and thread-safe, which makes it ideal for use in services and microservices.
By default WebEncoder will try to compress the data. If it manages to compress the data, the encoded data started with '.'.
Installation
pip install Web-Encoder
Typical usage example:
Encode session
web_encoder = WebEncoder()
session_id = "b801692b-135f-40ff-8f7e-016dc7748c45"
session = {"user_uuid": "67fa3e17-4672-4036-8184-7fbe4c097439"}
encoded_session = web_encoder.encode(json.dumps(session))
redis.set(session_id, encoded_session)
Decode session
web_encoder = WebEncoder()
session_id = "b801692b-135f-40ff-8f7e-016dc7748c45"
encoded_session = redis.get(session_id)
session = json.loads(web_encoder.decode(encoded_session))
Run as module
Encode
user@host:~$ python3 -m web_encoder e 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4
Decode
user@host:~$ python3 -m web_encoder d 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4'
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Test Coverage
Name Stmts Miss Cover
----------------------------------------------------------------
src/__init__.py 0 0 100%
src/web_encoder/__init__.py 4 0 100%
src/web_encoder/exceptions.py 34 0 100%
src/web_encoder/main.py 82 0 100%
tests/__init__.py 0 0 100%
tests/unit/__init__.py 0 0 100%
tests/unit/web_encoder/__init__.py 0 0 100%
tests/unit/web_encoder/test_web_encoder.py 244 0 100%
----------------------------------------------------------------
TOTAL 364 0 100%
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Web Encoder-0.1.2.tar.gz.
File metadata
- Download URL: Web Encoder-0.1.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f51c9ef55495d374cb22443b1c62ba8e1aea50f36cad99d377b615e3dd2ff6e0
|
|
| MD5 |
abc03082b82001b06886393f6dc25562
|
|
| BLAKE2b-256 |
5daeed1f44b72612332f464e4129a54203a0ce597f5e3296a191d5027966615c
|
File details
Details for the file Web_Encoder-0.1.2-py3-none-any.whl.
File metadata
- Download URL: Web_Encoder-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e1fe3aef40311d20d5bd22bcc1854aab4dbb4d008d3dc140bb4dfc71622ca2c
|
|
| MD5 |
09c4cc5d995f1e896d3550130545ab4b
|
|
| BLAKE2b-256 |
57180fc268963231877d90245b335a0322cbefcfedfc45868ced218f1e2896e7
|