Anaplan API 2.0 Python Library Certificate Error



We are trying to change from basic authentication to using a certificate.  I am using the Anaplan API 2.0 Python Library.


When running AnaplanConnection function I am getting the following error that I traced to the 


TypeError: from_buffer() cannot return the address of a unicode object


I have tried troubleshooting, but I have not been able to come up with any solutions.  Has anyone else had this issue?


It comes from this line of code:

key = serialization.load_pem_private_key(privKey, None, backend=backend)


Best Answer

  • @JaredDolich 


    I eventually figured it out.  I was passing the pem files as the name of the file string and not the certificate value.  I fixed the code and now it works.      


  • @forestsummers 

    Good job moving to a certificate. That's the best way. Two suggestions for you.

    • Make sure you have a private CA Certficate for an email address, called an “S/MIME Certificate” or an “email Certificate”. There are many types out there but you need one that can be associated with the email address you're using.
    • Read @chase.hippen most excellent article with examples on how to use certificates with Python.
  • Hi Jared,


    Thanks for helping, and for the resource.  I have not solved the issue, but maybe there is something I am missing.

  • Hello,


    Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread. Thanks for creating it. Looking forward for solution.

  • How did you fix the issue in terms of the code changes? We are getting the same error message trying to switch from basic authentication to certificate. I understand you were passing the name of the file instead of the certificate value. How did you change the code to fix it?