A python utility package
Project description
How to install?
python3 -m pip install --upgrade pip
wget https://github.com/juposs/pyutil/raw/v1.0/dist/pyutil-1.0-py3-none-any.whl
pip3 install
Defaults
Custom defaults can be stored in $HOME/pyutil_settings.json
See https://github.com/juposs/pyutil/blob/v1.0/pyutil_settings.json_sample
Everything that is not defined in $HOME/pyutil_settings.json will be read from
"$HOME/.local/lib/python3.X/site-packages/pyutil/defaults.py"
Usage:
ldap:
from pyutil import Ldap
Modify defaults and use the minumum parameters:
instance = Ldap("binduser@example.org", "strongpass", "john.doe@example.org")
or give all parameters:
instance = Ldap("binduser@example.org", "strongpass", "john.doe@example.org", "userPrincipalName", "OU=OrgUnit,DC=example,DC=org", "server.example.org")
then run query with that instance:
result = instance.query("pwdlastset")
result2 = instance.query("extensionAttribute12")
This will search for ldap object where userPrincipalName equals john.doe@example.org and return the value of pwdlastlet to the variable "result" and return whatever is in extensionAttribute12 to variable "result2"
mail:
from pyutil import Mail
Modify defaults and use the minumum parameters:
instance = Mail()
or give all parameters:
email = Mail("no-rely@example.org", "mailserver.example.org", "25", true, "/path/to/myfile.txt")
email = Mail("no-rely@example.org", "mailserver.example.org", "25", false)
then send the mail with that instance:
instance.send(subject, text, receipient1 [, receipient2])
logging:
from pyutil import Logger
Modify defaults and use the minumum parameters:
logfile1 = Logger()
or give all parameters:
logfile1 = Logger("/path/to/logfile", maxBytes=1000, backupCount=10)
Logfile will rotate after reaching maxBytes, default is '0', never rotate
If rotation enabled, it will keep 'backupCount' files, default is 10
then log stuff, for instance:
log1.info("info")
log1.warning("Warning")
log1.error("Error")
log1.debug("Debug")
Project details
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 pyutil-juposs-1.0.0.tar.gz.
File metadata
- Download URL: pyutil-juposs-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9c0e1e9e8ae5416d1a390d81a9bd53aa39ff4ad99e37f40f8907f60322cd7d5
|
|
| MD5 |
596af6d367ac4574a44a379deab58276
|
|
| BLAKE2b-256 |
97549c4f2cd36704f69c4dae2aee308686acb1755f152f2e2cbdd629e2b2cf9e
|
File details
Details for the file pyutil_juposs-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyutil_juposs-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c651b4f432d73acfc273f225ed55486d48a561ae043a044b258ec0668449c7b8
|
|
| MD5 |
18c9d1e79746b963e4127f88b34a3890
|
|
| BLAKE2b-256 |
ab990389d01fcf1b2e4501aa84e88b4b83d7ebf3a234553fd8718995df60be4d
|