Skip to content

Commit

Permalink
fix: wrong headers attr and added orionoid sub check
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Nov 5, 2024
1 parent fd5c726 commit 91d3f7d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/program/apis/overseerr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def delete_request(self, mediaId: int) -> bool:
settings = settings_manager.settings.content.overseerr
headers = {"X-Api-Key": settings.api_key}
try:
response = self.request_handler.execute(HttpMethod.DELETE, f"api/v1/request/{mediaId}", additional_headers=headers)
response = self.request_handler.execute(HttpMethod.DELETE, f"api/v1/request/{mediaId}", headers=headers)
logger.debug(f"Deleted request {mediaId} from overseerr")
return response.is_ok == True
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion src/program/apis/trakt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def get_imdbid_from_tvdb(self, tvdb_id: str, type: str = "show") -> Optional[str
def resolve_short_url(self, short_url) -> Union[str, None]:
"""Resolve short URL to full URL"""
try:
response = self.request_handler.execute(HttpMethod.GET, endpoint=short_url, additional_headers={"Content-Type": "application/json", "Accept": "text/html"})
response = self.request_handler.execute(HttpMethod.GET, endpoint=short_url, headers={"Content-Type": "application/json", "Accept": "text/html"})
if response.is_ok:
return response.response.url
else:
Expand Down
8 changes: 4 additions & 4 deletions src/program/services/downloaders/torbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# if not self.settings.api_key:
# logger.error("Torbox API key is not set")
# try:
# response = get(f"{self.base_url}/user/me", additional_headers=self.headers)
# response = get(f"{self.base_url}/user/me", headers=self.headers)
# if response.is_ok:
# user_info = response.data.data
# expiration = user_info.premium_expires_at
Expand Down Expand Up @@ -311,7 +311,7 @@
# hash_string = ",".join(hash_list)
# response = get(
# f"{self.base_url}/torrents/checkcached?hash={hash_string}&list_files=True",
# additional_headers=self.headers,
# headers=self.headers,
# response_type=dict,
# )
# return response.data["data"]
Expand All @@ -321,14 +321,14 @@
# response = post(
# f"{self.base_url}/torrents/createtorrent",
# data={"magnet": magnet_url, "seed": 1, "allow_zip": False},
# additional_headers=self.headers,
# headers=self.headers,
# )
# return response.data.data.torrent_id

# def get_torrent_list(self) -> list:
# response = get(
# f"{self.base_url}/torrents/mylist?bypass_cache=true",
# additional_headers=self.headers,
# headers=self.headers,
# response_type=dict,
# )
# return response.data["data"]
2 changes: 1 addition & 1 deletion src/program/services/scrapers/mediafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def validate(self) -> bool:
headers = {"Content-Type": "application/json"}

try:
response = self.request_handler.execute(HttpMethod.POST, url, overriden_response_type=ResponseType.DICT, json=payload, additional_headers=headers)
response = self.request_handler.execute(HttpMethod.POST, url, overriden_response_type=ResponseType.DICT, json=payload, headers=headers)
self.encrypted_string = json.loads(response.data)["encrypted_str"]
except Exception as e:
logger.error(f"Failed to encrypt user data: {e}")
Expand Down
3 changes: 3 additions & 0 deletions src/program/services/scrapers/orionoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def validate(self) -> bool:
url = f"{self.base_url}?keyapp={KEY_APP}&keyuser={self.settings.api_key}&mode=user&action=retrieve"
response = self.request_handler.execute(HttpMethod.GET, url, timeout=self.timeout)
if response.is_ok and hasattr(response.data, "result"):
if not response.data.data.subscription.package.enabled:
logger.error("Orionoid subscription is not active. Please check your subscription status.")
return False
if response.data.result.status != "success":
logger.error(
f"Orionoid API Key is invalid. Status: {response.data.result.status}",
Expand Down

0 comments on commit 91d3f7d

Please sign in to comment.