import http.client
import json
from datetime import datetime

conn = http.client.HTTPConnection("srvprod01", 8002)
payload = json.dumps({})
headers = {
  'Accept': 'application/json, text/plain, */*',
  'Accept-Language': 'en-US,en;q=0.5',
  'Connection': 'keep-alive',
  'Content-Type': 'application/json',
  'Origin': 'http://10.0.2.8:8081',
  'Referer': 'http://10.0.2.8:8081/',
  'Sec-GPC': '1',
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',
  'x-api-key': '@jisdsifd87493_(shdsjhj)_cbbxuf8y(H_H@!^GS)',
  'x-auth-token': '29eaddf7-0c0c-48be-87a2-000e6547a9f0',
  'x-content-type': 'application/json'
}
conn.request("POST", "/customer_service/sync_address/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

log_file = "D:\diffrenz\order_pro\order_pro\pvs_gent_crm\customer_service\jobs\sync_address.log"
today = datetime.now()

with open(log_file, "a", encoding="utf-8") as f:
    f.write(f'Date :{today}')
    f.write(data.decode("utf-8"))