No project description provided
Project description
GCS File Dependency Monitor is a Python library designed to wait for a specific file to appear in a Google Cloud Storage (GCS) bucket. If the file does not appear within a specified number of tries, it sends warning and error emails to a specified email address.
Features
- Monitors a GCS bucket for the presence of a specific file.
- Supports checking for files with names that include the current date.
- Sends warning emails after a certain number of unsuccessful tries.
- Sends an error email if the file does not appear after the maximum number of tries.
- Supports sending emails with optional attachments.
Requirements
- Python 3.x
- Google Cloud Storage client library
- smtplib for sending emails
Installation Install the package via pip:
pip install gcs-file-dependency-monitor
Dependencies
Make sure to have these installed using:
pip install google-cloud-storage
pip install datetime
Example Usage:
from gcs_file_dependency_monitor import gcs_file_dependency_monitor
gcs_file_dependency_monitor(
dependent_file='path/to/your/file',
dependent_file_bucket='your-bucket-name',
number_of_tries=10,
num_of_tries_before_warn_email=5,
time_interval=60,
warn_email_content='Warning: File not found yet.',
warn_email_subject='File Not Found Warning',
email_address='recipient@example.com',
error_email_content='Error: File not found after maximum tries.',
error_email_subject='File Not Found Error',
SMTP_SERVER='smtp.example.com',
SMTP_PORT=587,
SMTP_USER='your-smtp-user',
SMTP_PASSWORD='your-smtp-password',
dependent_file_name_has_current_date=True
)
Parameters: gcs_file_dependency_monitor This function waits for a specific file to appear in a GCS bucket and sends emails based on the result.
Parameters:
- dependent_file (str): The file to wait for.
- dependent_file_bucket (str): The GCS bucket containing the file.
- number_of_tries (int): The number of attempts to check for the file.
- num_of_tries_before_warn_email (int): The number of tries before sending a warning email.
- time_interval (int): The time interval (in seconds) between attempts.
- warn_email_content (str): The content of the warning email.
- warn_email_subject (str): The subject of the warning email.
- email_address (str): The recipient email address.
- error_email_content (str): The content of the error email.
- error_email_subject (str): The subject of the error email.
- SMTP_SERVER (str): The SMTP server for sending emails.
- SMTP_PORT (int): The port for the SMTP server.
- SMTP_USER (str): The SMTP server user.
- SMTP_PASSWORD (str): The SMTP server password.
- dependent_file_name_has_current_date (bool, optional): Whether the dependent file name includes the current date. Default is False.
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
File details
Details for the file Gcs_file_dependency_monitor-0.1.tar.gz
.
File metadata
- Download URL: Gcs_file_dependency_monitor-0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c94b7edfa7a3c0b6fb530b70d7de43ace87ce0a89374810c35589f4dc233ac9e |
|
MD5 | 85800e8b0fbc8c5343ec7db983636d3d |
|
BLAKE2b-256 | 378519e5e7b895cc11f613e8e7ea8586de848599df397febcedbcc166f813818 |
File details
Details for the file Gcs_file_dependency_monitor-0.1-py3-none-any.whl
.
File metadata
- Download URL: Gcs_file_dependency_monitor-0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fe4e3931755649c9847820f7e725031a098faeef4405bc7984faf04feefc946 |
|
MD5 | d9cb5d0fece8e690c2ffb7a2f4aa532e |
|
BLAKE2b-256 | 090047ad7bc1b2bb38c12593ae9926ab421d632880d5ade02ad7f8007d8e001e |