Spaces:
Runtime error
Runtime error
| import csv | |
| import datetime | |
| def list_at_index(extracted_list, index): | |
| value_at_index = extracted_list[index] | |
| return value_at_index | |
| def list_at_index_0(extracted_list): | |
| value_at_index = extracted_list[0] | |
| return value_at_index | |
| def list_at_index_1(extracted_list): | |
| value_at_index = extracted_list[1] | |
| return value_at_index | |
| def logger(log_filename, log_data, response): | |
| with open(log_filename, mode='a', newline='') as log_file: | |
| log_writer = csv.writer(log_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) | |
| # Get the current date and time | |
| current_datetime = datetime.datetime.now() | |
| date_str = current_datetime.strftime("%Y-%m-%d") | |
| time_str = current_datetime.strftime("%H:%M:%S") | |
| log_data.append(date_str) | |
| log_data.append(time_str) | |
| log_data.append(response) | |
| # Write the log data to the CSV file | |
| log_writer.writerow(log_data) | |