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.0.3.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for ndd_tools-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f887db56078a60578054b1b24663c10c88afe6561cb63331b2960ee0da9d55b |
|
MD5 | 3bd7c2d346435c489efd2632303e09ef |
|
BLAKE2b-256 | 9bdac5e4886a1e489e466002eb2ad4ba15678ddcfa7c5539adbf11d38eb7a350 |