Getting error “The runtime parameter of python3.7 is no longer supported use the new runtime (python3.12)”
Code follows;
import re
def extract_info(text):
info_dict = {
'Realtor Full Name': 'UNKNOWN',
'Realtor First Name': 'UNKNOWN',
'Realtor Last Name': 'UNKNOWN',
'Realtor Phone': None,
'Realtor Email': None,
'Client Full Name': 'UNKNOWN',
'Client First Name': 'UNKNOWN',
'Client Last Name': 'UNKNOWN',
'Client Phone': None,
'Client Email': None,
}
client_pattern = re.compile(r"Client Name: (\w+)(?: (\w+))?\nClient Phone: (.*?)\nClient Email: (\S+)?")
realtor_pattern = re.compile(r"Realtor Name: (\w+)(?: (\w+))?\nRealtor Phone: (.*?)\nRealtor Email: (\S+)?")
client_match = client_pattern.search(text)
if client_match:
first_name, last_name, phone, email = client_match.groups()
info_dict_'Client First Name'] = first_name
info_dict_'Client Last Name'] = last_name if last_name else 'UNKNOWN'
info_dict_'Client Full Name'] = f"{first_name} {last_name if last_name else 'UNKNOWN'}"
info_dict_'Client Phone'] = phone.strip() if phone else None
info_dict_'Client Email'] = email if email else None
realtor_match = realtor_pattern.search(text)
if realtor_match:
first_name, last_name, phone, email = realtor_match.groups()
info_dict_'Realtor First Name'] = first_name
info_dict_'Realtor Last Name'] = last_name if last_name else 'UNKNOWN'
info_dict_'Realtor Full Name'] = f"{first_name} {last_name if last_name else 'UNKNOWN'}"
info_dict_'Realtor Phone'] = phone.strip() if phone else None
info_dict_'Realtor Email'] = email if email else None
return info_dict
email_content = inputDatat'body_plain']
info = extract_info(email_content)
output = {'output': info}