Vonage / vonage-python-code-snippets

Python code examples for using Vonage communications APIs
MIT License
31 stars 56 forks source link

Voice Api Calling Error : Exception has occurred: TypeError Expecting a PEM-formatted key. #94

Closed JakeLong954 closed 1 year ago

JakeLong954 commented 2 years ago

`import os from os.path import join, dirname from pprint import pprint from vonage import * from dotenv import load_dotenv

dotenv_path = join(dirname(file), "../.env") load_dotenv(dotenv_path)

VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") VONAGE_APPLICATION_PRIVATE_KEY_PATH = os.environ.get("VONAGE_APPLICATION_PRIVATE_KEY_PATH") VONAGE_NUMBER = os.environ.get("VONAGE_NUMBER") TO_NUMBER = os.environ.get("TO_NUMBER")

client = vonage.Client( application_id=VONAGE_APPLICATION_ID, private_key=VONAGE_APPLICATION_PRIVATE_KEY_PATH, )

voice = vonage.Voice(client)

response = voice.create_call({ 'to': [{'type': 'phone', 'number': TO_NUMBER}], 'from': {'type': 'phone', 'number': VONAGE_NUMBER}, 'ncco': [{'action': 'talk', 'text': 'This is a text to speech call from Nexmo'}] })

pprint(response)`

the error im receiving when running this code is :

Exception has occurred: TypeError Expecting a PEM-formatted key. File "[C:\Users\mikea\Desktop\deleted\lil]() test\vonage-calls.py", line 25, in 'ncco': [{'action': 'talk', 'text': 'This is a text to speech call from Nexmo'}]

maxkahan commented 1 year ago

Closing as discussed on the community slack, as explained in the linked issue above.