【发布时间】:2020-08-16 15:46:44
【问题描述】:
我正在尝试将两个文字替换为用于短信的有效负载的变量:
import requests
url = "https://api.aql.com/v2/sms/send"
token='07ae4cca3f90a49347ccb5cfghypdngthwss85d9ce71862663e4b8162b366ba6c2db8f5f'
msg = "Ambient temperature has dropped to 10 Deg.C"
phone = "441234567890"
payload = "{\"destinations\" : [\"447753448024\"], \"message\": \"Hello, I am a message\"}"
headers = {
'x-auth-token': token,
'content-type': "application/json"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)
我希望插入变量 phone 和 msg 或文字
任何帮助将不胜感激
【问题讨论】:
-
这能回答你的问题吗? Modifying JSON with Python
标签: python string formatting sms