Added debugging

This commit is contained in:
Kevin Veen-Birkenbach 2023-09-03 20:25:39 +02:00
parent 0f265ba381
commit 28eb9677e8

View File

@ -23,8 +23,19 @@ def get_all_tables_from_database(base_url, api_key, database_id):
"Content-Type": "application/json"
}
response = requests.get(f"{base_url}database/tables/database/{database_id}/", headers=headers)
tables = response.json()
return tables
# Check if the response status code indicates success
if response.status_code != 200:
print(f"Error: Received status code {response.status_code} from Baserow API.")
print("Response content:", response.content.decode())
return []
try:
tables = response.json()
return tables
except requests.RequestsJSONDecodeError:
print("Error: Failed to decode the response as JSON.")
return []
def get_all_data_from_database(base_url, api_key, database_id):
tables = get_all_tables_from_database(base_url, api_key, database_id)