My Collection of Tools
Project description
LoggerMixin
usage
from ndd_tools import LoggerConfig, LoggerMixin
class A(LoggerMixin):
def __init__(self, logger_config: LoggerConfig, *args, **kwargs):
self.set_logger_up(logger_config)
# to enable debug mode: log message send to console
self.set_logger_debug_mode(True)
# to disable debug mode:
self.set_logger_debug_mode(False)
# to change log level, change in config or method
self.set_logger_level(loggingLevel)
# to add file handler
self.add_logger_file_handler(file_path: str, file_name: str, [formatter])
# get current logger config
self.get_logger_config()
# incase you want create new logger
# recreate new logger_config then use
self.set_logger_up(new_logger_config)
def run(self):
self.debug('this is debug log message')
self.info('this is info log message')
self.warn('this is warn log message')
self.error('this is error log message')
self.critical('this is critical log message')
example
ApiClient
usage
json_config_file_path = "/path/to/file/json"
client = ApiClient(json_config_file_path)
data = client.make_request('example1', header_dict, body_dict)
json format example
{
"name": "api endpoints",
"description": "hello",
"config": {
"example1": {
"method": "GET",
"url": "https://gorest.co.in/public/v1/users",
"header": {
"Content-Type": "application/json"
},
"parameters": {
"hello": "world"
},
"save_response": 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
ndd_tools-1.2.6.tar.gz
(11.8 kB
view details)
Built Distribution
File details
Details for the file ndd_tools-1.2.6.tar.gz
.
File metadata
- Download URL: ndd_tools-1.2.6.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7f9c83099808dfe39d46b2a352ba919406e485b8a9d4908c9fb0f55300cca7d |
|
MD5 | 693c10fddce6deff0336b98b904ca1bb |
|
BLAKE2b-256 | 2b1ee822ff25aa893da68f896176062d854eda3fb48c37dabe7a177b2793dece |
File details
Details for the file ndd_tools-1.2.6-py2.py3-none-any.whl
.
File metadata
- Download URL: ndd_tools-1.2.6-py2.py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ab3d17b900b57c0b0694cc6d8b6dc70f2f0e626dfa729bfb870d990fc490bb |
|
MD5 | e82cb95056f01cb100433392fccae2ac |
|
BLAKE2b-256 | 4493585badf6d6d57952a7bd1ea4831ce2441ed132b641c56ff906ac54b6b516 |