Skip to content

zorbaTheRainy/ztrlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zorbaTheRainy's Python Library

A collection of Python utilities for file operations, logging, networking, and type conversions.

Really not that impressive, but I do use them a lot.

Features

  • File Operations: Move, copy, and delete files and directories with robust error handling
  • Logging Utilities: Flexible logging configuration with console, file, and notification support
  • Network Utilities: Send webhooks with JSON payloads and file uploads
  • Type Conversions: Safe type conversion helpers with fallback defaults (and docker detection)
  • Miscellaneous Utilities: Things that don't fit elsewhere (e.g., docker detection)

Installation

Install directly from git:

pip install git+https://github.com/zorbaTheRainy/ztrlib.git

or install with apprise:

pip install "git+https://github.com/zorbaTheRainy/ztrlib.git#egg=ztrlib[apprise]"

Or upgrade:

pip install --force-reinstall git+https://github.com/zorbaTheRainy/ztrlib.git

Or requirements.txt:

ztrlib @ git+https://github.com/zorbaTheRainy/ztrlib.git

Dependencies

  • requests
  • send2trash
  • apprise [optional]

Usage

from ztrlib import move_file, add_console_logger, send_webhook, print_to_log

# Set up logging
add_console_logger()

# Move a file
move_file("example.txt", "/source/dir", "/target/dir")

# Send a webhook
resp = send_webhook("https://example.com/webhook", {"message": "Hello!"})

# Log a message
print_to_log.info("Webhook sent successfully and file moved.")

or (no from option)

import ztrlib

# Set up logging
ztrlib.add_console_logger()

# Move a file
ztrlib.move_file("example.txt", "/source/dir", "/target/dir")

# Send a webhook
resp = ztrlib.send_webhook("https://example.com/webhook", {"message": "Hello!"})

# Log a message
ztrlib.print_to_log.info("Webhook sent successfully and file moved.")

or (from option but only for things you use a lot)

import ztrlib
from ztrlib import print_to_log

# Set up logging
ztrlib.add_console_logger()

# Move a file
ztrlib.move_file("example.txt", "/source/dir", "/target/dir")

# Send a webhook
resp = ztrlib.send_webhook("https://example.com/webhook", {"message": "Hello!"})

# Log a message (direct access via from-import)
print_to_log.info("Webhook sent successfully and file moved.")

License

MIT License

About

A personal Python library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages