unas
apiunknown
python
2 years ago
1.2 kB
17
Indexable
def get_product_status(token, cikkszam):
payload = f"""<?xml version="1.0" encoding="UTF-8"?>
<Params>
<Sku>{cikkszam}</Sku>
<ContentType>minimal</ContentType>
</Params>"""
headers = {"Authorization": f"Bearer {token}"}
response = requests.post(f"{API_URL}getProduct", data=payload, headers=headers)
print("getProduct Response:", response.text) # Debugging statement
root = ET.fromstring(response.content)
status_element = root.find("Product/StatusBase")
if status_element is not None:
return int(status_element.text)
else:
return None
def set_product_active(token, cikkszam):
payload = f"""<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<Sku>{cikkszam}</Sku>
<Statuses>
<Status>
<Value>1</Value>
</Status>
</Statuses>
</Product>
</Products>"""
headers = {"Authorization": f"Bearer {token}"}
response = requests.post(f"{API_URL}setProduct", data=payload, headers=headers)
print("setProduct Response:", response.text) # Debugging statement
return response.status_code == 200Editor is loading...