Spaces:
Sleeping
Sleeping
import requests | |
import lib.ui.util.CONFIG as CONFIG | |
def fn_create_vector_store(ip_file_name:str, ip_domain:str): | |
# Endpoint URL | |
lv_url = CONFIG.VECTOR_STORE_API_URL | |
# Payload | |
lv_payload = {'domain': ip_domain} | |
lv_files=[ | |
('file', | |
( | |
ip_file_name, | |
open(ip_file_name,'rb'), | |
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |
) | |
) | |
] | |
lv_headers = {} | |
try: | |
# Send POST request to the API | |
lv_response = requests.request("POST", lv_url, headers=lv_headers, data=lv_payload, files=lv_files) | |
# Print the response JSON | |
return lv_response | |
except Exception as e: | |
# Handle any request exceptions | |
print(f"An error occurred: {e}") | |
raise e | |
def fn_create_data_mapping(ip_file_name:str, ip_source_domain:str): | |
# Endpoint URL | |
lv_url = CONFIG.MAPPING_API_URL | |
# Payload | |
lv_payload = {'source_domain': ip_source_domain} | |
lv_files=[ | |
('file', | |
( | |
ip_file_name, | |
open(ip_file_name,'rb'), | |
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |
) | |
) | |
] | |
lv_headers = {} | |
try: | |
# Send POST request to the API | |
lv_response = requests.request("POST", lv_url, headers=lv_headers, data=lv_payload, files=lv_files) | |
# Print the response JSON | |
return lv_response | |
except Exception as e: | |
# Handle any request exceptions | |
print(f"An error occurred: {e}") | |
raise e | |