Skip to main content

A python utility package

Project description

How to install?

python3 -m pip install --upgrade pip

pip3 install pyutil-juposs

Defaults

Custom defaults can be stored in $HOME/pyutil_settings.json

See https://github.com/juposs/pyutil/blob/master/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" depending on your installed python version

Usage:

  1. ldap: 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"
        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")
  1. 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])
  1. 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

pyutil-juposs-2.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyutil_juposs-2.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pyutil-juposs-2.0.0.tar.gz.

File metadata

  • Download URL: pyutil-juposs-2.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyutil-juposs-2.0.0.tar.gz
Algorithm Hash digest
SHA256 68f005d062eb747936ee020f8a84e8451f9f22c6493f7decbe4500d0cf56426a
MD5 b606c9b1cca9306980354032d31be6ea
BLAKE2b-256 533577074c558c0d82a9c8a64fcf3d3120fc73dd598e18631e0a0acb4ff1ffec

See more details on using hashes here.

File details

Details for the file pyutil_juposs-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyutil_juposs-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyutil_juposs-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 940c2ae73d3c6fd14a0e8a21943c956b2a7eeae6585cf98b70cccf96ff172d6c
MD5 41c27649ab238fe4aafc3c6623d2fe4d
BLAKE2b-256 7309ca65d7ce56bd60dd309c07808b929065145aa4c7ad7a47871d261cf58744

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page