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.3.tar.gz
(11.8 kB
view hashes)
Built Distribution
Close
Hashes for ndd_tools-1.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8be09256b192c1edc7abccd6e04d537530bd58128af1b90626dd6a7a690edd58 |
|
MD5 | e574642d19fe12cc35ed9345b92cfafa |
|
BLAKE2b-256 | f554a0e8fcc21515b5f32f1a2f856f1d0d044ddfacd237dcec47c2491500be22 |