def __init__(self, force=False): logger.debug("Initializing.") proxyURL = checkAndConfigureProxy() if proxyURL: Trakt.http.proxies = { 'http': proxyURL, 'https': proxyURL } Trakt.configuration.defaults.app( id=999 ) # Configure Trakt.configuration.defaults.client( id=self.__client_id, secret=self.__client_secret ) # Bind event Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth( refresh=True ) if getSetting('authorization') and not force: self.authorization = loads(getSetting('authorization')) else: last_reminder = getSettingAsInt('last_reminder') now = int(time.time()) if last_reminder >= 0 and last_reminder < now - (24 * 60 * 60) or force: self.login()
def __init__(self, force=False): logger.debug("Initializing.") proxyURL = checkAndConfigureProxy() if proxyURL: Trakt.http.proxies = { 'http': proxyURL, 'https': proxyURL } # Configure Trakt.configuration.defaults.client( id=self.__client_id, secret=self.__client_secret ) # Bind event Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth( refresh=True ) if getSetting('authorization') and not force: self.authorization = loads(getSetting('authorization')) else: last_reminder = getSettingAsInt('last_reminder') now = int(time.time()) if last_reminder >= 0 and last_reminder < now - (24 * 60 * 60) or force: self.login()