Skip to content

Commit

Permalink
Merge pull request #44 from jmaximusix/main
Browse files Browse the repository at this point in the history
added 10 second timeout to requests
  • Loading branch information
moehmeni authored Jun 5, 2024
2 parents 18189a8 + 61fdd17 commit 738f015
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion syncedlyrics/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import logging


class TimeoutSession(requests.Session):
def request(self, method, url, **kwargs):
kwargs.setdefault("timeout", (2,5))
return super().request(method, url, **kwargs)

class LRCProvider:
"""
Base class for all of the synced (LRC format) lyrics providers.
"""

def __init__(self) -> None:
self.session = requests.Session()
self.session = TimeoutSession()

# Logging setup
formatter = logging.Formatter("[%(name)s] %(message)s")
Expand Down

0 comments on commit 738f015

Please sign in to comment.