Skip to main content

Static code in python scripts

Project description

fastsetup

A Python library that has all the static repetitive code used in Python scripts, for easier and faster setup.

Installation

Use the package manager pip to install fastsetup.

pip install fastsetup

Usage and docs

import fastsetup

loggerMain, loggerInit, loggerProcess = fastsetup.main_log(log_folder)
# -----------------------------------------------------------------------
# Function: main_log(log_folder)
# Description: Creates and configures a main log and two additional logs.
# Parameters:
#   - log_folder (str): The folder path where log files will be stored.
# Returns:
#   - loggerMain (Logger): The main logger.
#   - loggerInit (Logger): The initialization logger.
#   - loggerProcess (Logger): The process logger.
# -----------------------------------------------------------------------

customLog = fastsetup.custom_log(log_folder, log_format, log_name)
# -----------------------------------------------------------------------
# Function: custom_log(log_folder, log_format, log_name)
# Description: Creates a custom log with a specified format.
# Parameters:
#   - log_folder (str): The folder path where log files will be stored.
#   - log_format (str): The format for log messages (default format used if None).
#   - log_name (str): The name for the custom log.
# Returns:
#   - customLog (Logger): The custom logger.
# -----------------------------------------------------------------------

Config_Name = fastsetup.get_config(Config_Path, SheetName, Key, Value)
# -----------------------------------------------------------------------
# Function: get_config(Config_Path, SheetName, Key, Value)
# Description: Reads a configuration file (Excel) and returns a dictionary.
# Parameters:
#   - Config_Path (str): The path to the configuration Excel file.
#   - SheetName (str): The name of the sheet within the Excel file.
#   - Key (str): The column name representing keys.
#   - Value (str): The column name representing values.
# Returns:
#   - Config (dict): A dictionary containing key-value pairs from the configuration.
# -----------------------------------------------------------------------

fastsetup.SMTP(config)
# -----------------------------------------------------------------------
# Function: SMTP(config)
# Description: Sends an email with attachments using SMTP protocol.
# Parameters:
#   - config (dict): A dictionary containing email configuration details.
#     Required keys: 'file_name', 'sender_email', 'to_email', 'email_subject',
#     'body_type', 'body', 'cc', 'attachments', 'server', 'port'.
# -----------------------------------------------------------------------

file_Name = fastsetup.SFTP_download(config)
# -----------------------------------------------------------------------
# Function: SFTP_download(config)
# Description: Downloads a file from a remote server using SFTP.
# Parameters:
#   - config (dict): A dictionary containing SFTP configuration details.
#     Required keys: 'host', 'user_name', 'password', 'SFTP_port',
#     'server_folder_name', 'server_file_name', 'local_file_path'.
# Returns:
#   - result: downloaded file.
# -----------------------------------------------------------------------

fastsetup.SFTP_upload(config)
# -----------------------------------------------------------------------
# Function: SFTP_upload(config)
# Description: Uploads a file to a remote server using SFTP.
# Parameters:
#   - config (dict): A dictionary containing SFTP configuration details.
#     Required keys: 'host', 'user_name', 'password', 'SFTP_port',
#     'local_file', 'target_location'.
# -----------------------------------------------------------------------

df = fastsetup.oracle_download(Config)
# -----------------------------------------------------------------------
# Function: oracle_download(Config)
# Description: Downloads data from an Oracle database using a provided query.
# Parameters:
#   - Config (dict): A dictionary containing Oracle database configuration details.
#     Required keys: 'host', 'port', 'data_source', 'user_ID', 'password', 'query'.
# Returns:
#   - df (DataFrame): A Pandas DataFrame containing the queried data.
# -----------------------------------------------------------------------

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

fastsetup-1.0.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

fastsetup-1.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file fastsetup-1.0.0.tar.gz.

File metadata

  • Download URL: fastsetup-1.0.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fastsetup-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3fe3f884dd3fe920e0bbafb16d8800c20dbde224dea8e0cceeb5e2c1c6f9be74
MD5 88ce9ba884cb2b093bf68f70e7529070
BLAKE2b-256 37152f1adbeba43c9f700049abbe94acde75f36f81045437aa2fa240d8aa4d3a

See more details on using hashes here.

File details

Details for the file fastsetup-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fastsetup-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fastsetup-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1281d2bdd33ce8407f07343795a415ed320f9c854295d9cd933f3f61da9f41b
MD5 83c627fb33e502164ecd8312d76504ea
BLAKE2b-256 581e4202cb117f8e43e6167bd677485023d180048a25bac8dcc56ba698e425eb

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