Files
Brancheneinstufung2/connector-superoffice/tools/so_surgical_update_v2.py

45 lines
1.2 KiB
Python

import os
import json
import sys
import requests
from dotenv import load_dotenv
# Path gymnastics
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "connector-superoffice"))
from superoffice_client import SuperOfficeClient
# Load ENV
load_dotenv(dotenv_path="/home/node/clawd/.env", override=True)
def surgical_update_v2(contact_id):
client = SuperOfficeClient()
print(f"--- Surgical Update V2: Contact {contact_id} ---")
# We now use the proper 'Urls' list format
payload = {
"contactId": int(contact_id),
"Department": "Final Round-Trip 13:20",
"Urls": [
{
"Value": "http://robo-planet.de",
"Description": "Website"
}
]
}
url = f"{client.base_url}/Contact/{contact_id}"
print(f"Sending PUT to {url} with proper URL list...")
resp = requests.put(url, headers=client.headers, json=payload)
print(f"Status Code: {resp.status_code}")
if resp.status_code == 200:
print("✅ SUCCESS! Website should be visible now.")
else:
print(f"❌ Error: {resp.text}")
if __name__ == "__main__":
surgical_update_v2(2)