Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

python - How to authenticate nexmo voice client?

I am trying to make an outbound call using Nexmo (Vonage) API. To access the API, I am required to authenticate my client using an application id and a private key (given to me as a .key file).

The application id was specified as a string and the private key was specified as a path.

client = nexmo.Client(application_id = 'xxxxxx-xxxxxxx', private_key = "C:\path\to\folder\private.key")

I get the following error.

  File "test_bot.py", line 30, in <module>
    'ncco': ncco
  File "C:UsersvishnAppDataLocalProgramsPythonPython37-32libsite-packageswraptwrappers.py", line 606, in __call__
    args, kwargs)
  File "C:UsersvishnAppDataLocalProgramsPythonPython37-32libsite-packagesdeprecatedclassic.py", line 285, in wrapper_function
    return wrapped_(*args_, **kwargs_)
  File "C:UsersvishnAppDataLocalProgramsPythonPython37-32libsite-packages
exmo\__init__.py", line 427, in create_call
    return self._jwt_signed_post("/v1/calls", params or kwargs)
  File "C:UsersvishnAppDataLocalProgramsPythonPython37-32libsite-packages
exmo\__init__.py", line 719, in _jwt_signed_post
    self.api_host(), self.session.post(uri, json=params, headers=self._headers())
  File "C:UsersvishnAppDataLocalProgramsPythonPython37-32libsite-packages
exmo\__init__.py", line 742, in _headers
    return dict(self.headers, Authorization=b"Bearer " + token)
TypeError: can't concat str to bytes
question from:https://stackoverflow.com/questions/65546722/how-to-authenticate-nexmo-voice-client

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Diana from Vonage here.

The fix is already on the way. However i noticed that this occurs only with pyjwt 2.0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...