python - 如何验证nexmo语音客户端?
问题描述
我正在尝试使用 Nexmo (Vonage) API 进行出站呼叫。要访问 API,我需要使用应用程序 ID 和私钥(作为 .key 文件提供给我)对我的客户端进行身份验证。
应用程序 ID 被指定为字符串,私钥被指定为路径。
client = nexmo.Client(application_id = 'xxxxxx-xxxxxxx', private_key = "C:\\path\\to\\folder\\private.key")
我收到以下错误。
File "test_bot.py", line 30, in <module>
'ncco': ncco
File "C:\Users\vishn\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wrapt\wrappers.py", line 606, in __call__
args, kwargs)
File "C:\Users\vishn\AppData\Local\Programs\Python\Python37-32\lib\site-packages\deprecated\classic.py", line 285, in wrapper_function
return wrapped_(*args_, **kwargs_)
File "C:\Users\vishn\AppData\Local\Programs\Python\Python37-32\lib\site-packages\nexmo\__init__.py", line 427, in create_call
return self._jwt_signed_post("/v1/calls", params or kwargs)
File "C:\Users\vishn\AppData\Local\Programs\Python\Python37-32\lib\site-packages\nexmo\__init__.py", line 719, in _jwt_signed_post
self.api_host(), self.session.post(uri, json=params, headers=self._headers())
File "C:\Users\vishn\AppData\Local\Programs\Python\Python37-32\lib\site-packages\nexmo\__init__.py", line 742, in _headers
return dict(self.headers, Authorization=b"Bearer " + token)
TypeError: can't concat str to bytes
解决方案
来自 Vonage 的戴安娜在这里。
修复已经在进行中。但是我注意到这只发生在 pyjwt 2.0 中。
推荐阅读
- javascript - javascript上的输入错误意外结束
- php - 在 WHERE 中使用多个 OR 项的查询返回整个表
- go - Golang mongo-go-driver 在负载测试期间在 collection.InsertOne 上挂起/超时
- react-native - 在 React Native 中使用 AppContainer 问题的所有页面中使用相同的自定义标题
- python - 如何使用 Tkinter 在 Python 中完成我的计算器?
- elisp - 无效的函数 Elisp
- ruby-on-rails - 在升级到 Rails 6.beta 时解决 gem 依赖问题
- javascript - 了解类的属性
- python - 如何在 Xlsxwriter 中锁定滚动?
- python - 如何指定要激活功能的按钮?