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


Python XmlManager.get方法代码示例

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


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

示例1: build_role

# 需要导入模块: import XmlManager [as 别名]
# 或者: from XmlManager import get [as 别名]
def build_role(account, role, key, add=True):
    '''build a request to add account to the role if add is True, if False
    build the request to remove account from the role'''
    if add:
        action = 'http://www.msn.com/webservices/AddressBook/AddMember'
        body = XmlManager.get('addmember', key, role, account)
    else:
        action = 'http://www.msn.com/webservices/AddressBook/DeleteMember'
        body = XmlManager.get('deletemember', key, role, account)

    return Request(action, 'omega.contacts.msn.com', 443,
        '/abservice/SharingService.asmx', body)
开发者ID:JPtja,项目名称:emesene,代码行数:14,代码来源:Requester.py

示例2: __init__

# 需要导入模块: import XmlManager [as 别名]
# 或者: from XmlManager import get [as 别名]
    def __init__(self, session, msg_queue, contact, message,
                  lockkey='', seq=1, first=True):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        me = session.contacts.me
        passport_id = session.extras['messengersecure.live.com']['security']
        nick = '=?%s?%s?=%s?=' % (
                'utf-8','B', me.display_name.encode('base64').strip())

        run_id = str(uuid4())

        content = message.encode('base64').strip()
        send_xml = XmlManager.get('sendoim', me.account, nick, common.MSNP_VER,
                                  common.BUILD_VER, contact, passport_id,
                                  challenge._PRODUCT_ID, str(lockkey),
                                  str(seq), run_id, str(seq), content)
        send_xml = send_xml.replace('\\r\\n', '\r\n')

        Requester.__init__(self, session,
          'http://messenger.live.com/ws/2006/09/oim/Store2',
          'ows.messenger.msn.com',443,'/OimWS/oim.asmx',
          send_xml.strip())

        self.contact = contact
        self.message = message
        self.oid = ''
        self.seq = seq
        self.first = first
        self.msg_queue = msg_queue

        log.debug('FROM:%s TO:%s' % (me.display_name, contact))
开发者ID:JPtja,项目名称:emesene,代码行数:34,代码来源:Requester.py

示例3: do_passport_identification

# 需要导入模块: import XmlManager [as 别名]
# 或者: from XmlManager import get [as 别名]
    def do_passport_identification(self):
        '''do the passport identification and get our passport id'''
        hash_ = self.session.extras['hash'].split()[-1]
        template = XmlManager.get('passport',
            self.session.account.account, self.session.account.password)

        if '@msn.com' not in self.session.account.account:
            server = "login.live.com"
            url = "/RST.srf"
        else:
            server = "msnia.login.live.com"
            url = "/pp550/RST.srf"

        #create the headers
        headers = { \
          'Accept' :  'text/*',
          'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
          'Host' : server,
          'Content-Length' : str(len(template)),
          'Connection' : 'Keep-Alive',
          'Cache-Control' : 'no-cache'
        }

        succeeded = False

        for i in range(5):
            response = None

            # send the SOAP request
            for i in range(3):
                try:

                    conn = httplib.HTTPSConnection(server, 443)
                    conn.request('POST', url, template, headers)
                    response = conn.getresponse()
                    break
                except Exception, exception:
                    pass

            if response:
                data = response.read()
                dbg(data, 'worker', 3)
            else:
                self.session.add_event(e3.Event.EVENT_LOGIN_FAILED,
                 'Can\'t connect to HTTPS server: ' + str(exception))
                self._on_login_failed()

            if data.find('<faultcode>psf:Redirect</faultcode>') > 0:
                url = urlparse.urlparse(data.split('<psf:redirectUrl>')\
                    [1].split('</psf:redirectUrl>')[0])

                server = url[1]
                url = url[2]
            else:
                succeeded = True
                break
开发者ID:nicolaide,项目名称:emesene,代码行数:58,代码来源:Worker.py


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