How to pass parametr name and value to nested function in Python

20 views Asked by At

I have a class which contains configs method taking a lot of possible arguments which are setup by default to None/False. I want to create main function which would take name of argument and value and pass it to inner function call. How can I do it?

class Builder:
    def __init__(input_json):
        self.input_json = input_json

    def generate_main_field(self, field_value):
        self.input_json["main_field"] = field_value
        return self.input_json

    def configs(self, proxy=None, call=False, currency=None, phone=None, email=False, is_vi=False, provider=None, config_new_field=None)
        self.json_file[proxy] = "xxx"
        return self.json_file

def main_builder(json_file, *params)
    b = Builder(json_file)
    b.configs(*params)
    return json_file
0

There are 0 answers