【问题标题】:How to solve InterFAX python library 400 error?如何解决 InterFAX python 库 400 错误?
【发布时间】:2021-09-17 15:24:25
【问题描述】:

我一直在做一个需要发送传真的 django 项目。
我使用interfax python library发送传真。
要从 html 生成 pdf,我使用的是 xhtml2pdf。
我像下面这样写,它没有用并引发错误。 我不知道现在该怎么办。
请帮忙。

代码

# interfax authentication
interfax_password = config("INTERFAX_PASSWORD")
interfax_account = config("INTERFAX_ACCOUNT")
interfax = InterFAX(username=interfax_account, password=interfax_password)

f = File(interfax, pdf, mime_type="application/pdf")
fax_number = config("INTERFAX_DESTINATION")

# actually sending the data
fax = interfax.outbound.deliver(fax_number=fax_number, files=[f])

抛出的错误
equests.exceptions.HTTPError: 400 Client Error: Bad Request for url:https://rest.interfax.net/outbound/faxes?faxNumber=111111111

先感谢您

【问题讨论】:

  • 当我打印像这样 print(f.headers) 这样的标题时,我发现它是空的。
  • 应该是Content-Type: application/pdf。你有什么想法吗?

标签: python html django pdf interfax


【解决方案1】:

我想我只需要直接使用 API。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-20
    • 1970-01-01
    • 2020-09-02
    • 2015-11-21
    • 2014-04-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-17
    相关资源
    最近更新 更多