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


Python Login.start方法代码示例

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


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

示例1: init_config

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import start [as 别名]
 def init_config(recipe_kind):
     if recipe_kind == 'zhihu':      # TODO: 再有一个需要登录的网站, 改掉硬编码
         login = Login(recipe_kind='zhihu')
     else:
         return
     # !!!!!发布的时候把Config.remember_account改成false!!!!!,第一次需要登录,之后用cookie即可
     # 登陆成功了,自动记录账户
     if Config.remember_account_set:
         Debug.logger.info(u'检测到有设置文件,直接使用之前的设置')
         # if raw_input():
         # login.start()
         # Config.picture_quality = guide.set_picture_quality()
         Config.picture_quality = 1
         # else:
         try:
             Http.set_cookie()   # sinablog, jianshu: DontNeed
         except TypeError:
             print u"没有找到登录成功的cookie记录, 请重新登录"
             login.start()
     else:
         log.warning_log(u"Please login...")
         login.start()
         # Config.picture_quality = guide.set_picture_quality()
         Config.picture_quality = 1
         Config.remember_account_set = True
     # save config
     Config._save()
     return
开发者ID:gitter-badger,项目名称:EE-Book,代码行数:30,代码来源:main.py

示例2: init_config

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import start [as 别名]
    def init_config():
        login = Login()
        if Config.remember_account:
            print u"检测到有设置文件,是否直接使用之前的设置?(帐号、密码、图片质量)"
            print u"点按回车使用之前设置,敲入任意字符后点按回车进行重新设置"
            if raw_input():
                login.start()
                Config.picture_quality = guide.set_picture_quality()
            else:
                Http.set_cookie()
        else:
            login.start()
            Config.picture_quality = guide.set_picture_quality()

        # 储存设置
        Config._save()
        return
开发者ID:zuiwan,项目名称:ZhihuHelp,代码行数:19,代码来源:main.py

示例3: __init__

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import start [as 别名]
class WAXMPP:
    SERVER = 's.whatsapp.net'
    USER_AGENT = "iPhone-2.8.3"

    def __init__(
        self,
        user,
        push_name,
        password,
        ):

        self.domain = WAXMPP.SERVER
        self.resource = WAXMPP.USER_AGENT
        self.user = user
        self.push_name = push_name
        self.password = password
        self.jid = user + '@' + WAXMPP.SERVER
        self.fromm = user + '@' + WAXMPP.SERVER + '/' + WAXMPP.USER_AGENT
        self.supports_receipt_acks = False
        self.msg_id = 0

        self.retry = True
        self.event = WAEventHandler(self)
        self.stanzaReader = None

        self.disconnectRequested = False

        self.connTries = 0

        self.verbose = True
        self.iqId = 0
        self.lock = threading.Lock()

        self.waiting = 0

        self.conn = None
        self.inn = None
        self.out = None
        self.event.loginSuccess.connect(self.onLoginSuccess)
        self.event.connectionError.connect(self.onConnectionError)

    def onLoginSuccess(self):
        self.connectionTries = 0
        c = StanzaReader(self)

        self.stanzaReader = c

        self.stanzaReader.start()

        self.sendClientConfig('', '', False, '')
        self.sendAvailableForChat()
        self.event.connected.emit()

    def onConnectionError(self):
        pass

    def disconnect(self):
        self.event.disconnectRequested.emit()
        self.disconnectRequested = True

    def login(self):
        self.conn = MySocketConnection()
        self.inn = BinTreeNodeReader(self.conn, Login.dictionary)
        self.out = BinTreeNodeWriter(self.conn, Login.dictionary)

        self.walogin = Login(self)
        self.walogin.start()

    def sendTyping(self, jid):
        composing = ProtocolTreeNode('composing',
                {'xmlns': 'http://jabber.org/protocol/chatstates'})
        message = ProtocolTreeNode('message', {'to': jid, 'type': 'chat'
                                   }, [composing])
        self.out.write(message)

    def sendPaused(self, jid):
        composing = ProtocolTreeNode('paused',
                {'xmlns': 'http://jabber.org/protocol/chatstates'})
        message = ProtocolTreeNode('message', {'to': jid, 'type': 'chat'
                                   }, [composing])
        self.out.write(message)

    def getSubjectMessage(
        self,
        to,
        msg_id,
        child,
        ):
        messageNode = ProtocolTreeNode('message', {'to': to,
                'type': 'subject', 'id': msg_id}, [child])

        return messageNode


    def sendSubjectReceived(self, to, msg_id):
        receivedNode = ProtocolTreeNode('received',
                {'xmlns': 'urn:xmpp:receipts'})
        messageNode = self.getSubjectMessage(to, msg_id, receivedNode)
        self.out.write(messageNode)

#.........这里部分代码省略.........
开发者ID:Oscar123456,项目名称:python-whatsapi,代码行数:103,代码来源:waxmpp.py


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