我是twilio和python的新手。我想使用twilio api构建一个简单的传真命令。所以我使用它,它完美地工作
fax = client.fax.faxes \
.create(
from_="+18566198960",
media_url="https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf",
to="+14105210871"
)
print(fax.sid)
但是,我想将media_url更改为位于doc文件夹中的本地文件,因此我使用此media_url
media_url="../doc/testfax.doc"
但是我得到了这个错误
HTTP错误您的请求是:
POST /传真
Twilio返回了以下信息:
无法创建记录:参数“MediaUrl”无效
更多信息可在此处获得:
如何将本地文件指定为要发送的传真内容?
我查看了Twilio API发送传真 - https://www.twilio.com/docs/fax/send
这个需要:
* A destination phone number or SIP URI.
* A From number - this can be either an Incoming Phone Number or an Outgoing Caller ID. (Optional for SIP destinations.)
* A URL which points to the media that will be sent via fax (currently, this must be a PDF file; see our security page for information on how to ensure the request for your media comes from Twilio).
API不支持本地文件(仅包含带有PDF文件的URL)。