📜  python 到 php - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:43.893000             🧑  作者: Mango

代码示例4
import requests
import json
data = {
   "api_key": "PRIVATE_API_KEY",
   "profiles": [
       {
           "$consent": ["sms"],
           "phone_number": "+12345678900",
           "sms_consent": True
       }
   ]
}
headers = {
   "Content-Type": "application/json",
   "Cache-Control": "no-cache"
   }
conv = json.dumps(data)
response = requests.request("POST", "https://a.klaviyo.com/api/v2/list/{LIST_ID}/subscribe", data=conv, headers=headers)
print(response.text)