ringcentral / ringcentral-python

RingCentral Connect Platform Python SDK
MIT License
45 stars 35 forks source link

issue with fax attachments in sandbox with python SDK #50

Closed fchepil closed 1 year ago

fchepil commented 1 year ago

This is code snippet communicating with RC API that attempts to send a pdf doc for faxing.

` rcsdk = SDK(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER)

platform = rcsdk.platform()
platform.login(RINGCENTRAL_USERNAME,
               RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD)

# platform.login(jwt=RC_JWT)
builder = rcsdk.create_multipart_builder()
builder.set_body({
    'to': [{'phoneNumber': recipient}],
    'faxResolution': "High",
    'coverPageText': "Clinic Name \n" + str(sender)
})

with open(faxdoc, encoding="utf8", errors='ignore') as f:
    content = f.read()
    attachment = (faxdoc, content)

builder.add(attachment)

request = builder.request('/account/~/extension/~/fax')

resp = platform.send_request(request)`

Everything looks good and this is output in terminal DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): platform.devtest.ringcentral.com:443 DEBUG:urllib3.connectionpool:https://platform.devtest.ringcentral.com:443 "POST /restapi/oauth/token HTTP/1.1" 200 574 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): platform.devtest.ringcentral.com:443 DEBUG:urllib3.connectionpool:https://platform.devtest.ringcentral.com:443 "POST /restapi/v1.0/account/~/extension/~/fax HTTP/1.1" 200 None INFO:root:E:\pyfaxrc\apps\response\12047861522__E:\pyfaxrc\apps\outbound\test.pdf

The fax that is received is 2 pages, a cover page and a 2nd page that has a watermark saying "test fax using ring central developer account"

The Sandbox Console shows the service as having a successful transmission, even though the attachment was not sent. if I test with a jpeg attachment, I do not receive any fax and the event logs are identical as the pdf, with exception of the filename and extension.

Any advisement appreciated.

PS: (the code snippet that opens the file was changed per RC community advisement as I was receiving errors when using the original code sample.

tylerlong commented 1 year ago

Refer to https://github.com/ringcentral/ringcentral-python/blob/master/ringcentral/demos/demo_fax.py

As we tested, it is working fine.

If you have issues, please kindly create a new ticket here: https://developers.ringcentral.com/support/create-case