The configuration file encompasses parameters for heading fonts, heading sizes, text fonts, text sizes, and maximum character limits. The objective is to automate the customization of these configuration file elements in accordance with user preferences and requirements.
# Config extractor
def config_extractor():
# Loading the config file
with open(r'config file path here') as config_file:
config_details = json.load(config_file)
# Setting up Heading_Fonts
Heading_fonts = config_details["Heading_fonts"]
# Setting up Heading_size
Heading_size = config_details["Heading_size"]
# Setting up Heading_Fonts
Text_fonts = config_details["Text_fonts"]
# Setting up Heading_size
Text_size = config_details["Text_size"]
# Max length
maxlength = config_details["max_length"]
api = config_details["api"]
return Heading_fonts, Heading_size, Text_fonts, Text_size, maxlength, api
Heading_fonts, Heading_size, Text_fonts, Text_size, maxlength, api_key = config_extractor()
print(f"Heading_fonts : {Heading_fonts}\nHeading_size : {Heading_size}\nText_fonts : {Text_fonts}\nText_size : {Text_size}\nmaxlength : {maxlength}\napi : {api_key}")
Please note that for the code to function correctly, you need to replace 'config file path here'
with the actual path to the configuration file on your system. Additionally, the code assumes that the re
and json
modules have been imported elsewhere in the code.