Skip to main content

Crypto wrappers

Project description

Zurck'z

ZCrypto Wrapper


ZPy Database Core

Zurck'z Py

This package contains some helpers features for encrypt data .

ZPy use the following packages:

  • pycrypto

Requirements

  • Python 3.6+

Installation

Use the package manager pip to install py flask micro service core .

pip install zpy
pip install package_directory directory_to_install

Features

Contains some helper features with specific integrations.

  • Database
    • Only MySQL implementation
      • Functions executor
      • Stored Procedures executor
      • Autocommit is false by default
  • Utils
    • funcs

Roadmap

  • ActiveRecord implementation
  • Cluster

Basic Usage

Basic Configuration

config = {
    "user": "",
    "password": "",
    "database": "",
    "host": "",
    "port": 3306
}

With single datasource

# Create database mediator with single datasource
db_manager = ZMediator.single(config, True)
# Open connection
db_conn = db_manager.default().new_connect()
try:
    # Execute function
    res = db_manager.default().exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
    print(res)
except Exception as e:
    logging.exception(e)
finally:
    # ⚠ Remember close opened connection
    db_conn.close()

Multiple Datasources

# Define db mediator 
# Setup base configuration in ZMediator()
# The base configuration will be overwritten by add common values 
db_mngr = ZMediator(config, False)
.add_common("DB_NAME_1", "DB_USER", "DB_PASSWORD", True)  # Mark default ds
.add_common("DB_NAME_2", "DB_USER", "DB_PASSWORD")
.add_common("DB_NAME_3", "DB_USER", "DB_PASSWORD")

db_conn1 = db_mngr.default().new_connect()
db_conn2 = db_mngr.get("DB_NAME_1").new_connect()
db_conn3 = db_mngr.get("DB_NAME_3").new_connect()

try:
    # Execute function
    res = db_mngr.default().exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
    print(res)
    # Execute function
    res = db_mngr.get("DB_NAME_2").exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
    print(res)
    # Call sp
    res = db_mngr.get("DB_NAME_3").call("SP_GET_DATA", ret_type=DBTypes.cursor)
    print(res)
except Exception as e:
    logging.exception(e)
finally:
    # ⚠ Remember close opened connections
    db_conn1.close()
    db_conn2.close()
    db_conn3.close()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Authors

Noé Cruz

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

zpy-ciphers-utils-0.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

zpy_ciphers_utils-0.0.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file zpy-ciphers-utils-0.0.1.tar.gz.

File metadata

  • Download URL: zpy-ciphers-utils-0.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for zpy-ciphers-utils-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6609bfc1dbad1e38773367776e46e8467a531a0e1f6b9be5411fd6bee6abe4e2
MD5 dc8c5ba22c35cbffc6c5611bc1f65d2f
BLAKE2b-256 3f9f3d5b61fe96d75332f9524dee28df46ebcd61148301a1395e74cbcf58d83c

See more details on using hashes here.

File details

Details for the file zpy_ciphers_utils-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: zpy_ciphers_utils-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for zpy_ciphers_utils-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 984b1a35a37899bb4eeb1427026344464489bbc5355355e3d6207248c2700e70
MD5 4c74927dc6a9be8d491c0000d4e9882b
BLAKE2b-256 dc424d6fbf5ae47d3da509ea50d49247cbfbb6f2b13a3073bb715dd6cb645b67

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