Spaces:
Configuration error
Configuration error
| import requests | |
| import json | |
| # Config | |
| SERVER_URL = "http://localhost:8000" | |
| HOUSE_ID = "c8c5fdea-7138-44ea-9f02-7fdcd47ff8cf" | |
| OBJECT_ID = "d522cf34-4b45-4a18-aabc-1d9592a4e628" | |
| OWNER_NAME = "Brian Clark" | |
| OWNER_TYPE = "person" # Or "dog", "robot", etc. | |
| def add_owner_by_name(house_id, object_id, name, type="person"): | |
| payload = { | |
| "house_id": house_id, | |
| "object_id": object_id, | |
| "name": name, | |
| "type": type | |
| } | |
| print(f"Sending request to add owner '{name}' (type: {type}) to object '{object_id}'...") | |
| response = requests.post(f"{SERVER_URL}/object/add_owner_by_name", json=payload) | |
| if response.status_code == 200: | |
| owner_info = response.json() | |
| print("β Successfully added owner:") | |
| print(json.dumps(owner_info, indent=2)) | |
| else: | |
| print(f"β Failed to add owner. Status {response.status_code}: {response.text}") | |
| if __name__ == "__main__": | |
| add_owner_by_name(HOUSE_ID, OBJECT_ID, OWNER_NAME, OWNER_TYPE) | |