Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
tikhonp committed Jul 24, 2021
1 parent c74a31e commit a3e2658
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = speechkit
version = 1.3.4
version = 1.3.5
author = Tikhon Petrishchev
author_email = tikhon.petrishchev@gmail.com
description = It's lib for using speechkit api by yandex.
Expand Down
8 changes: 4 additions & 4 deletions src/speechkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests

__author__ = 'Tikhon Petrishchev'
__version__ = '1.3.4'
__version__ = '1.3.5'


class InvalidDataError(ValueError):
Expand All @@ -20,8 +20,8 @@ class RequestError(Exception):
"""Exception raised for errors while yandex api request"""

def __init__(self, answer: dict):
self.code = answer.get('error_code')
self.message = answer.get('error_message')
self.code = str(answer.get('code', '')) + str(answer.get('error_code', ''))
self.message = str(answer.get('message')) + str(answer.get('error_message', ''))
super().__init__(self.code + ' ' + self.message)


Expand Down Expand Up @@ -355,7 +355,7 @@ def __init__(self, yandex_passport_oauth_token):
answer = requests.post(url, json=data)

if answer.ok:
self.token = answer.get('iamToken')
self.token = answer.json().get('iamToken')
else:
raise RequestError(answer.json())

Expand Down

0 comments on commit a3e2658

Please sign in to comment.