A utilities module made for personal use, has small snippets which I use in many projects.
Project description
pypers
Package with helper scripts.
Contains some helper function which make up its name: python+helpers = pypers.
Usage:
pypers.mongo_helpers:
from pypers.mongo_helpers import AsyncMongoDB
db = AsyncMongoDB('localhost:27017', 'pypers')
db.collection = "test"
await db.insert_one({'name': 'pypers'})
results = await db.find_one({'name': 'pypers'})
print(results)
await db.delete_one({'name': 'pypers'})
pypers.namespace:
from pypers.namespace import Namespace
ns = Namespace(
a=1,
b=2,
c=Namespace(
d=3,
e=4,
),
)
print(ns.a)
print(ns.b)
print(ns.c.d)
print(ns.c.e)
pypers.url_helpers:
from pypers.url_helpers import UrlHelpers
from pypers.url_helpers import AioHttp
new_url = await UrlHelpers.shorten_url('https://www.google.com')
print(new_url)
json, resp = AioHttp.get_json('https://www.google.com')
print(json, resp)
text, resp = AioHttp.get_text('https://www.google.com')
print(text, resp)
raw, resp = AioHttp.get_raw('https://www.google.com')
print(raw, resp)
json, resp = AioHttp.post_json('https://www.google.com')
print(json, resp)
pypers.image_tools:
from pypers.image_tools import ImageTools
new_img = ImageTools.compress_image('/path/to/image.jpg', quality=50)
print(new_img)
pypers.formatters:
from pypers.formatters import Formatters
humanbytes_size = Formatters.humanbytes(1024*1024)
print(humanbytes_size)
human_time = Formatters.time_formatter(15000)
print(human_time)
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
pypers-1.1.0.tar.gz
(6.6 kB
view details)
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 pypers-1.1.0.tar.gz.
File metadata
- Download URL: pypers-1.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
164d138954de971166dd8fa88eac847a49708fd68c6de05daa093869bd24acc5
|
|
| MD5 |
a661f1ff9ecb273b181df2e711b7b54d
|
|
| BLAKE2b-256 |
2bce7dfbd6ecc4aa54f00517beafe35ace9422aaa87c2e711234ef062f7f8172
|
File details
Details for the file pypers-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pypers-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf81a8422129f4b1ca2c5ac8d494b661f005e90834a2dafa88df8c6c055e3e46
|
|
| MD5 |
a11a81af2a7dc2e7f4de326360bea236
|
|
| BLAKE2b-256 |
7a88614162bf8eeb5893fc43152cf612f66a2a0fd8058dcf8f494b55dac0a403
|