Set a timeout and use session connection pool for getting file sizes

This commit is contained in:
kermit 2020-09-29 19:36:26 +01:00
parent 48f6026c75
commit 04eb63b4cd
1 changed files with 3 additions and 1 deletions

View File

@ -81,7 +81,9 @@ class Deezer:
def get_track_filesizes(self, sng_id): def get_track_filesizes(self, sng_id):
try: try:
response = requests.post("https://www.deezer.com/", headers=self.http_headers) response = requests.post("https://www.deezer.com/",
headers=self.http_headers,
timeout=30)
guest_sid = response.cookies.get('sid') guest_sid = response.cookies.get('sid')
site = requests.post( site = requests.post(
"https://api.deezer.com/1.0/gateway.php", "https://api.deezer.com/1.0/gateway.php",