本文整理汇总了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
示例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
示例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)
#.........这里部分代码省略.........