Fix simkl requests

This commit is contained in:
Zoe Roux 2024-03-21 01:30:38 +01:00
parent 380c80bbaf
commit 1e8316e16d
No known key found for this signature in database

View File

@ -35,7 +35,7 @@ class Simkl(Service):
"https://api.simkl.com/sync/history", "https://api.simkl.com/sync/history",
json={ json={
"episodes": { "episodes": {
"watched_at": watch_date, "watched_at": watch_date.isoformat(),
"ids": { "ids": {
service: id.data_id service: id.data_id
for service, id in resource.external_id.items() for service, id in resource.external_id.items()
@ -44,10 +44,10 @@ class Simkl(Service):
}, },
headers={ headers={
"Authorization": f"Bearer {user.external_id["simkl"].token.access_token}", "Authorization": f"Bearer {user.external_id["simkl"].token.access_token}",
"simkl_api_key": self._api_key, "simkl-api-key": self._api_key,
}, },
) )
logging.debug("Simkl response: %s", resp.json()) logging.info("Simkl response: %s %s", resp.status_code, resp.text)
return return
category = "movies" if resource.kind == "movie" else "shows" category = "movies" if resource.kind == "movie" else "shows"
@ -74,10 +74,10 @@ class Simkl(Service):
}, },
headers={ headers={
"Authorization": f"Bearer {user.external_id["simkl"].token.access_token}", "Authorization": f"Bearer {user.external_id["simkl"].token.access_token}",
"simkl_api_key": self._api_key, "simkl-api-key": self._api_key,
}, },
) )
logging.debug("Simkl response: %s", resp.json()) logging.info("Simkl response: %s %s", resp.status_code, resp.text)
def _to_simkl_status(self, status: Status): def _to_simkl_status(self, status: Status):
match status: match status: