def initialize_logging(verbosity: typing.AnyStr): logging.basicConfig( level=LOG_LEVELS.get(verbosity, logging.INFO), format=LOG_FORMAT, datefmt=LOG_DATE_FORMAT, ) L = getLogger() verbosity = verbosity.upper() if verbosity not in LOG_LEVELS.keys(): L.warning("%s is not a log level, set to INFO", verbosity)
def __encode_fields( self, fields: typing.Dict[str, str], request_method: typing.AnyStr, ): """ create request string """ sep = ',' encoded_string = [] request_method = request_method.upper() for k in fields: encoded_string.append(k + ':"' + fields[k] + '"') encoded_string = "{" + sep.join(encoded_string) + "}" if 'GET' == request_method: encoded_string = base_64_encode(encoded_string) return encoded_string