我使用的是MailJet的smsapi,在正确使用token/authentication语法时遇到了麻烦。在
在cURL中,请求应该如下所示(cfDocs):
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v4/sms-send \
-H 'Content-Type: application/json' \
-d '{
"From": "MJPilot",
"To": "+33600000000",
"Text": "Have a nice SMS flight with Mailjet!"
}'
但我不知道如何将这个短语转换成Python,这是我目前的想法:
^{pr2}$作出如下回应:
SMS SENT{'ErrorIdentifier': 'f403ce05-1db3-4c30-ac74-314fa93a9e84', 'ErrorCode': 'mj-0002', 'ErrorMessage': 'Malformed JSON, please review the syntax and properties types.', 'StatusCode': 400}
我知道我的令牌是有效的,因为我可以通过邮递员正确地运行请求
您的有效负载是}:
json
,因此kwarg是json
,而不是{另外,在有效负载中,它看起来应该是}
"Text"
而不是{相关问题 更多 >
编程相关推荐