Skip to content

Commit

Permalink
feat(classes.py): add retry decorator for _request (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
dobizz committed Nov 5, 2023
1 parent cefd921 commit 260db98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
python-dotenv>=0.20.0
requests>=2.28.2
retry2>=0.9.5
2 changes: 2 additions & 0 deletions src/pyplayht/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from urllib.parse import urljoin, urlparse, urlunparse

import requests
from retry import retry

from pyplayht.types import VoiceType

Expand Down Expand Up @@ -105,6 +106,7 @@ def download_file(self, uri: str) -> bytes:
response = self._request("GET", new_url)
return response.content

@retry(tries=3, delay=5, backoff=2)
def _request(
self,
method: str,
Expand Down

0 comments on commit 260db98

Please sign in to comment.