简体   繁体   中英

How to solve InterFAX python library 400 error?

I've been working on a django project that needs to send faxes.
For sending faxes I am using interfax python library .
To generate pdf from html, I am using xhtml2pdf.
I wrote like below, and it didn't work and threw an error. I don't know what to do now.
Please help.

The code

# 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])

The error thrown
equests.exceptions.HTTPError: 400 Client Error: Bad Request for url:https://rest.interfax.net/outbound/faxes?faxNumber=111111111

Thank you in advance

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM