How to solve InterFAX python library 400 error?

92 views Asked by At

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
1

There are 1 answers

0
AudioBubble On BEST ANSWER

I think I just need to use the API directly.