当前位置: 首页>>代码示例>>Python>>正文


Python Cookies.getCookieJar方法代码示例

本文整理汇总了Python中cookies.Cookies.getCookieJar方法的典型用法代码示例。如果您正苦于以下问题:Python Cookies.getCookieJar方法的具体用法?Python Cookies.getCookieJar怎么用?Python Cookies.getCookieJar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cookies.Cookies的用法示例。


在下文中一共展示了Cookies.getCookieJar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deviceShortAuthorize

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def deviceShortAuthorize(self, streamProvider, mso_id):
        """
        Authorise for a particular channel... a second time.
        @param streamProvider the stream provider (eg: the SportsnetNow
                              instance)
        @param mso_id the MSO identifier (eg: 'Rogers')
        @return the session token required to authorise video the stream
        """
        settings = Settings.instance().get('adobe')

        values = { 'requestor_id' : streamProvider.getRequestorID(),
                   'signed_requestor_id' : streamProvider.getSignedRequestorID(),
                   'session_guid' : uuid.uuid4(),
                   'hashed_guid' : 'false',
                   'authz_token' : settings['AUTHZ_TOKEN'],
                   'mso_id' : mso_id,
                   'device_id' : streamProvider.getDeviceID() }

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        opener.addheaders = [('User-Agent', urllib.quote(self.USER_AGENT))]

        try:
            resp = opener.open(self.DEVICE_SHORT_AUTHORIZE, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
            return ''
开发者ID:micahg,项目名称:plugin.video.cdncbl,代码行数:30,代码来源:adobe.py

示例2: authorize

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def authorize(streamProvider, username, password):
        """
        Perform authorization with Rogers

        @param streamProvider the stream provider object. Needs to handle the 
                              getAuthURI.
        @param username the username to authenticate with
        @param password the password to authenticate with
        """

        uri = streamProvider.getAuthURI('Rogers')

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))#,
                                      #urllib2.HTTPHandler(debuglevel=1),
                                      #urllib2.HTTPSHandler(debuglevel=1))

        try:
            resp = opener.open(uri)
        except:
            print "Unable get OAUTH location"
            return None
        Cookies.saveCookieJar(jar)

        html = resp.read()

        viewstate = re.search('<input.*__VIEWSTATE.*?value=\"(.*?)\".*?>', html, re.MULTILINE)
        if not viewstate:
            return None

        validation = re.search('<input.*__EVENTVALIDATION.*?value=\"(.*?)\".*?>', html, re.MULTILINE)
        if not validation:
            return None

        return Rogers.getOAuthToken(username, password, viewstate.group(1), validation.group(1), resp.url)
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:37,代码来源:rogers.py

示例3: preAuthorize

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def preAuthorize(self, streamProvider, resource_ids):
        """
        Pre-authroize.  This _should_ get a list of authorised channels.

        @param streamProvider the stream provider (eg: the SportsnetNow
                              instance)
        @param resource_ids a list of resources to preauthorise
        @return a dictionary with each resource id as a key and boolean value
                indicating if the resource could be authorised
        """
        settings = Settings.instance().get('adobe')

        values = { 'authentication_token' : settings['AUTHN_TOKEN'],
                   'requestor_id' : streamProvider.getRequestorID() }

        value_str = urllib.urlencode(values)
        for resource_id in resource_ids:
            value_str += '&' + urllib.urlencode({ 'resource_id' : resource_id })

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        opener.addheaders = [('User-Agent', urllib.quote(self.USER_AGENT))]

        try:
            resp = opener.open(self.PREAUTHORIZE_URI, value_str)
        except urllib2.URLError, e:
            print e.args
            return False
开发者ID:micahg,项目名称:plugin.video.cdncbl,代码行数:31,代码来源:adobe.py

示例4: callback

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def callback(username, password):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
        opener.addheaders = [('User-Agent', urllib.quote(Sportsnet.USER_AGENT))]

        values = { 'callback' : 'mvpdSignInCallback',
                   'username' :  username,
                   'password' : password,
                   't' : str(int(time.time())) }
        try:
            resp = opener.open('https://now.sportsnet.ca/secure/mvpd/myrogers?'+urllib.urlencode(values))
        except:
            print "Unable to login with signinmvpd"
            return False

        res = resp.read()
        json_data  = re.search('mvpdSignInCallback\((.*?)\)', res, re.MULTILINE)
        if not json_data:
            return False

        jsres = json.loads(json_data.group(1))

        if not 'code' in jsres.keys():
            return True

        if jsres['code'] != 'loginsuccess':
            return False

        return True
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:31,代码来源:sportsnet.py

示例5: authorizeDevice

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def authorizeDevice(self, streamProvider, mso_id, channel):
        """
        Authorise the device for a particular channel.

        @param streamProvider the stream provider (eg: the SportsnetNow
                              instance)
        @param mso_id the MSO identifier (eg: 'Rogers')
        @param channel the channel identifier
        """
        settings = Settings.instance().get('adobe')

        values = { 'resource_id' : channel,
                   'requestor_id' : streamProvider.getRequestorID(),
                   'signed_requestor_id' : streamProvider.getSignedRequestorID(),
                   'mso_id' : mso_id,
                   'authentication_token' : settings['AUTHN_TOKEN'],
                   'device_id' : streamProvider.getDeviceID(),
                   'userMeta' : '1' }

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        opener.addheaders = [('User-Agent', urllib.quote(self.USER_AGENT))]

        try:
            resp = opener.open(self.AUTHORIZE_URI, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
            return False
开发者ID:micahg,项目名称:plugin.video.cdncbl,代码行数:31,代码来源:adobe.py

示例6: authorize

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def authorize(streamProvider, username, password):
        """
        Perform authorization with Telus

        @param streamProvider the stream provider object. Needs to handle the 
                              getAuthURI.
        @param username the username to authenticate with
        @param password the password to authenticate with
        """

        uri = streamProvider.getAuthURI('telus_auth-gateway_net')

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        try:
            resp = opener.open(uri)
        except:
            print "Unable get Telus OAUTH location"
            return None
        Cookies.saveCookieJar(jar)

        html = resp.read()

        values = parseForm(['SAMLRequest', 'RelayState'], html)
        action = values.pop('action')
        if values == None:
            print "Form parsing failed in authorize"
            return None

        return Telus.getBookend(username, password, values, action)
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:33,代码来源:telus.py

示例7: completeBackgroundLogin

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def completeBackgroundLogin():
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        try:
            resp = opener.open('https://sp.auth.adobe.com/adobe-services/completeBackgroundLogin')
        except urllib2.URLError, e:
            print e.args
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:10,代码来源:shawgo.py

示例8: authGateway

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def authGateway(values, url):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        try:
            resp = opener.open(url, urllib.urlencode(values))
        except urllib2.URLError, e:
            if e.reason[1] == "No address associated with hostname":
                return True
            return None
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:12,代码来源:telus.py

示例9: getChannels

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def getChannels(self):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
        opener.addheaders = [("User-Agent", urllib.quote(self.USER_AGENT))]

        try:
            resp = opener.open(self.CHANNELS_URI)
        except urllib2.URLError, e:
            print e.args
            return None
开发者ID:micahg,项目名称:plugin.video.cdncbl,代码行数:12,代码来源:snnow.py

示例10: discoveryAssociations

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def discoveryAssociations(url):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        values = { 'AuthState' : url[url.find('='):] }

        try:
            resp = opener.open(url, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
            return None
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:13,代码来源:telus.py

示例11: getBookendAgain

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def getBookendAgain(username, password, values, url):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        values = urllib.urlencode(values)
        url += '?' + values

        try:
            resp = opener.open(url, values)
        except urllib2.URLError, e:
            print e.args
            return None
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:14,代码来源:telus.py

示例12: getSAMLAssertionConsumer

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def getSAMLAssertionConsumer(saml, relay, url): 

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        values = {'SAMLResponse' : saml,
                  'RelayState' : relay }

        try:
            resp = opener.open(url, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:14,代码来源:shawgo.py

示例13: postLogin

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def postLogin(username, password, url):
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        values = {
            'username' : username, 
            'password' : password 
        }

        try:
            resp = opener.open(url, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:15,代码来源:cogeco.py

示例14: lastBookend

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def lastBookend(values, url):
        """
        Make the lastBookend call
        """
        values['history'] = '7'
        url = url + '?' + urllib.urlencode(values)

        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        try:
            resp = opener.open(url)
        except urllib2.URLError, e:
            print e.args
            return None
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:17,代码来源:telus.py

示例15: postAuthSaml

# 需要导入模块: from cookies import Cookies [as 别名]
# 或者: from cookies.Cookies import getCookieJar [as 别名]
    def postAuthSaml(username, password, saml, relay, url):
        
        jar = Cookies.getCookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))

        values = {
            'SAMLRequest' : saml, 
            'RelayState' : relay 
        }

        try:
            resp = opener.open(url, urllib.urlencode(values))
        except urllib2.URLError, e:
            print e.args
            return None
开发者ID:siuside,项目名称:plugin.video.snnow,代码行数:17,代码来源:cogeco.py


注:本文中的cookies.Cookies.getCookieJar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。