PYCOF

https://pepy.tech/badge/pycof https://badge.fury.io/py/pycof.svg https://github.com/fluidicon.png

PYCOF is a library to group some useful functions on Python. The library helps running SQL queries or send emails in a much simpler way.

The library is pip-installable and the source code is available on my Git. For any question or suggestion of improvement, please contact me.

Installation

You can get PYCOF from PyPI with:

pip3 install pycof

The library is supported on Windows, Linux and MacOS.

Setup

The functions pycof.sql.remote_execute_sql() and pycof.format.send_email() will, by default, look for the credentials located in /etc/.pycof/config.json. On Windows, save the config file as C:/Users/<username>/.pycof/config.json.

The file follows the below structure:

{
"DB_USER": "",
"DB_PASSWORD": "",
"DB_HOST": "",
"DB_PORT": "3306",
"DB_DATABASE": "",
"__COMMENT_1__": "Email specific, send_email",
"EMAIL_USER": "",
"EMAIL_SENDER": "",
"EMAIL_PASSWORD": "",
"EMAIL_SMTP": "smtp.gmail.com",
"EMAIL_PORT": "587",
"__COMMENT_2__": "IAM specific, if connection='SSH' in remote_execute_sql",
"CLUSTER_NAME": "",
"AWS_ACCESS_KEY_ID": "",
"AWS_SECRET_ACCESS_KEY": "",
"REGION": "eu-east-3",
"__COMMENT_3__": "SSH specific",
"SSH_USER": "",
"SSH_KEY": "",
"SSH_PASSWORD": ""
}

On Unix based system, run:

sudo nano /etc/.pycof/config.json

and paste the above json after filling the empty strings (pre-filled values are standard default values).

Reminder: To save the file, with nano press CTRL + O, confirm with ENTER then CTRL + X to exit.

On Windows, use the path C:/Users/<username>/.pycof/config.json.

Release and FAQ

Indices and tables