def checkHTTPS(self, userData):
        util.debug('[SC] kontrolujem nastavenia HTTPS s WS [%s] [%s]' %
                   (getSetting('ws_usessl'),
                    userData.find('wants_https_download').text))
        toggle = False
        if getSettingAsBool('ws_usessl') is not True and userData.find(
                'wants_https_download').text == '1':
            toggle = True
        elif getSettingAsBool('ws_usessl') is True and userData.find(
                'wants_https_download').text == '0':
            toggle = True

        if toggle:
            headers, req = self._create_request('/', {'wst': self.token})
            try:
                util.info('[SC] userData menim nastavenie http(s)')
                data = post(self._url('api/toggle_https_download/'),
                            req,
                            headers=headers,
                            output="content")
                util.debug('[SC] zmena: %s' % str(data))
            except:
                self.clearToken()
                return False
            pass
    def checkHTTPS(self, userData):
        util.debug('[SC] kontrolujem nastavenia HTTPS s WS [%s] [%s]' %
                   (getSetting('ws_usessl'),
                    userData.find('wants_https_download').text))
        toggle = False
        if getSettingAsBool('ws_usessl') is not True and userData.find(
                'wants_https_download').text == '1':
            toggle = True
        elif getSettingAsBool('ws_usessl') is True and userData.find(
                'wants_https_download').text == '0':
            toggle = True

        if toggle:
            headers, req = self._create_request('/', {'wst': self.token})
            try:
                util.info('[SC] userData menim nastavenie http(s)')
                data = post(
                    self._url('api/toggle_https_download/'),
                    req,
                    headers=headers,
                    output="content")
                util.debug('[SC] zmena: %s' % str(data))
            except:
                self.clearToken()
                return False
            pass
Beispiel #3
0
 def __init__(self, username=None, password=None, cache=None):
     self.username = username.encode('utf-8')
     self.password = password.encode('utf-8')
     self.base_url = 'http://webshare.cz/'
     if getSettingAsBool('ws_checkssl') is False:
         setSetting('ws_checkssl', 'true')
         res = checkSupportHTTPS(self.base_url)
         setSetting('ws_usessl', 'true' if res is True else 'false')
     if getSettingAsBool('ws_usessl') is True:
         self.base_url = self.base_url.replace('http://', 'https://')
     self.cache = cache
     self.win = xbmcgui.Window(10000)
     self.getToken()
 def __init__(self, username=None, password=None, cache=None):
     self.username = username.encode('utf-8')
     self.password = password.encode('utf-8')
     self.base_url = 'http://webshare.cz/'
     if getSettingAsBool('ws_checkssl') is False:
         setSetting('ws_checkssl', 'true')
         res = checkSupportHTTPS(self.base_url)
         setSetting('ws_usessl', 'true' if res is True else 'false')
     if getSettingAsBool('ws_usessl') is True:
         self.base_url = self.base_url.replace('http://', 'https://')
     self.cache = cache
     self.win = xbmcgui.Window(10000)
     self._userData = None
     self.token = None
     self.getToken()