Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getUser(self):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True):
result = Trakt['users/settings'].get()
return result
def getMoviesCollected(self, movies):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True, timeout=90):
Trakt['sync/collection'].movies(movies, exceptions=True)
return movies
def addToWatchlist(self, mediaObject):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True):
result = Trakt['sync/watchlist'].add(mediaObject)
return result
def removeFromCollection(self, mediaObject):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True):
result = Trakt['sync/collection'].remove(mediaObject)
return result
def getUser(self):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True):
result = Trakt['users/settings'].get()
return result
def oauth_authorization(self, oauth_credential=None):
if oauth_credential is None:
oauth_credential = self.oauth
log.debug('Using oauth authorization for %r', self)
return Trakt.configuration.oauth.from_response(oauth_credential.to_response(), refresh=True)
def getEpisodePlaybackProgress(self):
progressEpisodes = []
# Fetch playback
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True):
playback = Trakt['sync/playback'].episodes(exceptions=True)
for _, item in list(playback.items()):
if type(item) is Show:
progressEpisodes.append(item)
return progressEpisodes
def getShowsCollected(self, shows):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True, timeout=90):
Trakt['sync/collection'].shows(shows, exceptions=True)
return shows
def getEpisodesRated(self, shows):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True, timeout=90):
Trakt['sync/ratings'].episodes(shows, exceptions=True)
return shows
def getShowsRated(self, shows):
with Trakt.configuration.oauth.from_response(self.authorization):
with Trakt.configuration.http(retry=True, timeout=90):
Trakt['sync/ratings'].shows(shows, exceptions=True)
return shows