Skip to content

Commit

Permalink
Jellyfin: Add timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Luigi311 <git@luigi311.com>
  • Loading branch information
luigi311 committed Jan 16, 2024
1 parent 01ad15e commit 84b98db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/jellyfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,19 @@ def query(self, query, query_type, session=None, identifiers=None):
}

if query_type == "get":
response = self.session.get(self.baseurl + query, headers=headers)
response = self.session.get(
self.baseurl + query, headers=headers, timeout=self.timeout
)
if response.status_code != 200:
raise Exception(
f"Query failed with status {response.status} {response.reason}"
)
results = response.json()

elif query_type == "post":
response = self.session.post(self.baseurl + query, headers=headers)
response = self.session.post(
self.baseurl + query, headers=headers, timeout=self.timeout
)
if response.status_code != 200:
raise Exception(
f"Query failed with status {response.status} {response.reason}"
Expand Down

0 comments on commit 84b98db

Please sign in to comment.