Select Git revision
api_client.py
api_client.py 532 B
# utils/api_client.py
import requests
import time
def send_api_request(url, payload):
try:
# Assuming it's a POST request
start_time = time.time()
response = requests.post(url, json=payload)
response_time = time.time() - start_time
# Assuming response.json() gives us the actual data as a dictionary
return response.json(), response_time
except Exception as e:
print(f"API Request Error: {str(e)}")
return {}, 0 # Return an empty dict and 0 time on error