Abc / utils /SpecificLocationInformation.py
grayphite's picture
added modules
a7fc713
import json
import requests
from utils.common import ACCOUNT_ID, BASE_URL, HEADER, LOCATION_ID
specific_location_information_tool = {
"type": "function",
"function": {
"name": "SpecificLocationInformation",
"description": "Fetches location details for a specific account and location.",
"parameters": {
"type": "object",
"properties": {
"account_id": {
"type": "string",
"description": "ID of the account to fetch account details from.",
"default": ACCOUNT_ID
},
"location_id": {
"type": "string",
"description": "ID of the location to fetch location details for.",
"default": LOCATION_ID
}
},
"required": ["account_id", "location_id"]
}
}
}
def SpecificLocationInformation(account_id=ACCOUNT_ID, location_id=LOCATION_ID):
"""Fetch and print location details for a specific account and location."""
url = f"{BASE_URL}account/{account_id}/locations/{location_id}"
try:
response = requests.get(url, headers=HEADER)
response.raise_for_status() # Raise an HTTPError for bad responses
response_data = response.json()
formatted_response = json.dumps(response_data, indent=2)
return formatted_response
except requests.RequestException as e:
return f"Error making API request: {str(e)}"