Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 8e1a700

Browse files
Fixes some stuff
2 parents 98353f1 + 9484edf commit 8e1a700

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

openrobot/api_wrapper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
from . import _async, _sync, translate, results, error, speech
99

10-
__version__ = '0.3.0.3'
10+
__version__ = '0.3.0.3'

openrobot/api_wrapper/_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ async def _request(self, method: str, url: str, **kwargs) -> typing.Union[dict,
126126
raise TooManyRequests(resp, js)
127127

128128
try:
129-
await asyncio.sleep(resp.headers['Retry-After'])
129+
await asyncio.sleep(int(resp.headers['Retry-After']))
130130
except KeyError as e:
131-
raise KeyError('Retry-After header is not present.') from e
131+
raise KeyError('Retry-After header is not present.') from e # this probably wont trigger, but either way we still need to handle it, right?
132132

133133
if tries:
134134
tries -= 1
@@ -314,4 +314,4 @@ def translate(self) -> Translate:
314314
@property
315315
def speech(self) -> Speech:
316316
""":class:`Speech`: The Speech client."""
317-
return Speech(self, True)
317+
return Speech(self, True)

openrobot/api_wrapper/_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def _request(self, method: str, url: str, **kwargs):
114114
raise TooManyRequests(r, js)
115115

116116
try:
117-
time.sleep(r.headers['Retry-After'])
117+
time.sleep(int(r.headers['Retry-After']))
118118
except KeyError as e:
119-
raise KeyError('Retry-After header is not present.') from e
119+
raise KeyError('Retry-After header is not present.') from e # this probably wont trigger, but either way we still need to handle it, right?
120120

121121
if tries:
122122
tries -= 1
@@ -258,4 +258,4 @@ def translate(self):
258258
@property
259259
def speech(self) -> Speech:
260260
""":class:`Speech`: The Speech client."""
261-
return Speech(self, False)
261+
return Speech(self, False)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ docs = ["sphinx", "karma_sphinx_theme", "sphinxcontrib-asyncio", "sphinx-nervpro
2626

2727
[build-system]
2828
requires = ["poetry-core>=1.0.0"]
29-
build-backend = "poetry.core.masonry.api"
29+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)