Python itchat 模块,auto_login() 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用itchat.auto_login()

项目:base_function    作者:Rockyzsu    | 项目源码 | 文件源码
def testcase1():
    id='@5493580a22c9ba5db849ba33d0911d3d'
    content=datetime.datetime.now().strftime("%H:%M:%S")
    itchat.auto_login(hotReload=True)
    #itchat.auto_login()
    itchat.send(content,toUserName='filehelper')
    account=itchat.get_friends(u'wwwei')
    print account
    print type(account)
    for i in account:
        #print type(i)
        #print i
        if i[u'PYQuanPin']==u'????':
            print i['UserName']
            #print i
    #itchat.send(content, toUserName=id)

    print 'done'
项目:WerewolvesWechatBot    作者:LouYu2015    | 项目源码 | 文件源码
def __init__(self, game_controller):
        super().__init__(game_controller)

        self.username_to_user = {} # Map Wechat user name to WechatUser object
        self.send_msg_queue = queue.Queue() # Avoid sending messages too fast by buffering

        # Start listening Wechat messages
        itchat.auto_login()
        threading.Thread(target = itchat.run).start()

        # Send messages in another thread
        threading.Thread(target = self.send_messages_in_queue).start()

        # Accept new messages from players
        @itchat.msg_register(itchat.content.TEXT)
        def listen_wechat_message(message_info):
            username = message_info['User']['UserName'] # User name of the Wechat user
            text = message_info['Text'] # Content of the message
            self.got_message(username, text)
项目:auto_chat    作者:SmallPond    | 项目源码 | 文件源码
def login_chat_init():
    # ??Linux ? Windows ??
    os_paltform = platform.system()
    # ????? hotReload?????????????????, ???????
    # for some linux system, width of block character is one instead of two, so enableCmdQR should be 2
    if os_paltform == "Windows":
        print("This is windows system\n")
        itchat.auto_login(hotReload=True)
    else:
        itchat.auto_login(hotReload=True, enableCmdQR=2)
    # ???????????????????name?????
    # ????????????
    #I = itchat.search_friends()
    #I.send("hello")


# ???????????
项目:base_function    作者:Rockyzsu    | 项目源码 | 文件源码
def testcase2():
    itchat.auto_login(hotReload=True)
    print itchat.get_friends()
项目:WxNeteaseMusic    作者:yaphone    | 项目源码 | 文件源码
def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
            enableCmdQR=False, picDir=None, qrCallback=None,
            loginCallback=None, exitCallback=None):
        ''' log in like web wechat does
            for log in
                - a QR code will be downloaded and opened
                - then scanning status is logged, it paused for you confirm
                - finally it logged in and show your nickName
            for options
                - hotReload: enable hot reload
                - statusStorageDir: dir for storing log in status
                - enableCmdQR: show qrcode in command line
                    - integers can be used to fit strange char length
                - picDir: place for storing qrcode
                - loginCallback: callback after successfully logged in
                    - if not set, screen is cleared and qrcode is deleted
                - exitCallback: callback after logged out
                    - it contains calling of logout
                - qrCallback: method that should accept uuid, status, qrcode
            for usage
                ..code::python

                    import itchat
                    itchat.auto_login()

            it is defined in components/register.py
            and of course every single move in login can be called outside
                - you may scan source code to see how
                - and modified according to your own demond
        '''
        raise NotImplementedError()
项目:stock    作者:Rockyzsu    | 项目源码 | 文件源码
def push_wechat(name, real_price, real_percent, type):
    name=u'wwwei'
    itchat.auto_login(hotReload=True)
    account=itchat.get_friends(name)
    for i in account:
        if i[u'PYQuanPin']==name:
            toName=i['UserName']
    content=name+' ' + str(real_price)+' '+ str(real_percent)+' percent '+ type
    itchat.send(content,toUserName=toName)
项目:RasWxNeteaseMusic    作者:yaphone    | 项目源码 | 文件源码
def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
            enableCmdQR=False, picDir=None, qrCallback=None,
            loginCallback=None, exitCallback=None):
        ''' log in like web wechat does
            for log in
                - a QR code will be downloaded and opened
                - then scanning status is logged, it paused for you confirm
                - finally it logged in and show your nickName
            for options
                - hotReload: enable hot reload
                - statusStorageDir: dir for storing log in status
                - enableCmdQR: show qrcode in command line
                    - integers can be used to fit strange char length
                - picDir: place for storing qrcode
                - loginCallback: callback after successfully logged in
                    - if not set, screen is cleared and qrcode is deleted
                - exitCallback: callback after logged out
                    - it contains calling of logout
                - qrCallback: method that should accept uuid, status, qrcode
            for usage
                ..code::python

                    import itchat
                    itchat.auto_login()

            it is defined in components/register.py
            and of course every single move in login can be called outside
                - you may scan source code to see how
                - and modified according to your own demond
        '''
        raise NotImplementedError()
项目:wbot    作者:PY-Learning    | 项目源码 | 文件源码
def run(self):
        """???Bot"""
        logger.info("Bot Server start running...")
        try:
            itchat.auto_login(hotReload=True, enableCmdQR=2)
            self.after_login()
            itchat.run()
        except KeyboardInterrupt:
            logger.info("KeyboardInterrupt occurred ...  Quitting, Bye.")
        self.before_destory()
项目:Neural-Headline-Generator-CN    作者:QuantumLiu    | 项目源码 | 文件源码
def login():
    if 'Windows' in platform.system():
        itchat.auto_login(enableCmdQR=1,hotReload=True)#
    else:
        itchat.auto_login(enableCmdQR=2,hotReload=True)#
    itchat.dump_login_status()#dump
#==============================================================================
# 
#==============================================================================
项目:Neural-Headline-Generator-CN    作者:QuantumLiu    | 项目源码 | 文件源码
def on_epoch_end(self, epoch, logs=None):
        for k in self.params['metrics']:
            if k in logs:
                self.mesg+=(k+': '+str(logs[k])[:5]+' ')
                self.logs_epochs.setdefault(k, []).append(logs[k])
#==============================================================================
#         except:
#             itchat.auto_login(hotReload=True,enableCmdQR=True)
#             itchat.dump_login_status()
#             self.t_send(self.mesg, toUserName='filehelper')
#==============================================================================
        if epoch+1>=self.stopped_epoch:
            self.model.stop_training = True
        logs = logs or {}
        self.epoch.append(epoch)
        self.t_epochs.append(time.time()-self.t_s)
        if self.savelog:
            sio.savemat((self.fexten if self.fexten else self.validateTitle(self.localtime))+'_logs_batches'+'.mat',{'log':np.array(self.logs_batches)})
            sio.savemat((self.fexten if self.fexten else self.validateTitle(self.localtime))+'_logs_epochs'+'.mat',{'log':np.array(self.logs_epochs)})
        th.start_new_thread(self.get_fig,())
#==============================================================================
#         try:
#             itchat.send(self.mesg, toUserName='filehelper')
#         except:
#             traceback.print_exc()
#             return
#==============================================================================
        self.t_send(self.mesg, toUserName='filehelper')
        return
#==============================================================================
#         
#==============================================================================
项目:jubi_api    作者:Rockyzsu    | 项目源码 | 文件源码
def __init__(self, send='wechat'):
        cfg = Toolkit.getUserData('data.cfg')
        self.public_key = cfg['public_key']
        self.private_key = cfg['private_key']
        self.send=send
        from_mail = cfg['from_mail']
        password = cfg['password']
        to_mail = cfg['to_mail']
        smtp_server = 'smtp.qq.com'

        self.server = smtp_server
        self.username = from_mail.split("@")[0]
        self.from_mail = from_mail
        self.password = password
        self.to_mail = to_mail
        self.coin_list=['IFC','DOGE','EAC','DNC','MET','ZET','SKT','YTC','PLC','LKC',
                        'JBC','MRYC','GOOC','QEC','PEB','XRP','NXT','WDC','MAX','ZCC',
                        'HLB','RSS','PGC','RIO','XAS','TFC','BLK','FZ','ANS','XPM','VTC',
                        'KTC','VRC','XSGS','LSK','PPC','ETC','GAME','LTC','ETH','BTC']
        # ???????????????
        # ????????
        if self.send == 'msn':

            try:
                self.smtp = smtplib.SMTP_SSL(port=465)
                self.smtp.connect(self.server)
                self.smtp.login(self.username, self.password)
            except smtplib.SMTPException, e:
                print e
                return 0

        if send=='wechat':
            self.w_name=u'wwwei'
            #self.w_name1=u'wwwei'
            itchat.auto_login(hotReload=True)
            account=itchat.get_friends(self.w_name)
            for i in account:
                if i[u'PYQuanPin']==self.w_name:
                    self.toName= i['UserName']
                    #print self.toName
项目:hzlgithub    作者:hzlRises    | 项目源码 | 文件源码
def  main():
    #????
    itchat.auto_login(hotReload=True)
    user_content = itchat.search_friends(name=u'????')
    userName = user_content[0]['UserName']
    itchat.send(getWeather(101230201),toUserName = userName)#??
    itchat.send(getWeather(101010100),toUserName = userName)#??
项目:tricks    作者:ipreacher    | 项目源码 | 文件源码
def login():
    itchat.auto_login()


# ?????????
项目:tricks    作者:ipreacher    | 项目源码 | 文件源码
def login():
    itchat.auto_login()


# ????????
项目:langrensha    作者:weilantian    | 项目源码 | 文件源码
def login(cmdQR=False):
        itchat.auto_login(hotReload=True,enableCmdQR=cmdQR)
项目:turing-chat    作者:CosmoGao    | 项目源码 | 文件源码
def main():
    itchat.auto_login(enableCmdQR=True + (platform.system() == 'Linux'))
    itchat.run()
项目:ItChat    作者:littlecodersh    | 项目源码 | 文件源码
def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
            enableCmdQR=False, picDir=None, qrCallback=None,
            loginCallback=None, exitCallback=None):
        ''' log in like web wechat does
            for log in
                - a QR code will be downloaded and opened
                - then scanning status is logged, it paused for you confirm
                - finally it logged in and show your nickName
            for options
                - hotReload: enable hot reload
                - statusStorageDir: dir for storing log in status
                - enableCmdQR: show qrcode in command line
                    - integers can be used to fit strange char length
                - picDir: place for storing qrcode
                - loginCallback: callback after successfully logged in
                    - if not set, screen is cleared and qrcode is deleted
                - exitCallback: callback after logged out
                    - it contains calling of logout
                - qrCallback: method that should accept uuid, status, qrcode
            for usage
                ..code::python

                    import itchat
                    itchat.auto_login()

            it is defined in components/register.py
            and of course every single move in login can be called outside
                - you may scan source code to see how
                - and modified according to your own demond
        '''
        raise NotImplementedError()
项目:Soda    作者:linuxb    | 项目源码 | 文件源码
def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
            enableCmdQR=False, picDir=None, qrCallback=None,
            loginCallback=None, exitCallback=None):
        ''' log in like web wechat does
            for log in
                - a QR code will be downloaded and opened
                - then scanning status is logged, it paused for you confirm
                - finally it logged in and show your nickName
            for options
                - hotReload: enable hot reload
                - statusStorageDir: dir for storing log in status
                - enableCmdQR: show qrcode in command line
                    - integers can be used to fit strange char length
                - picDir: place for storing qrcode
                - loginCallback: callback after successfully logged in
                    - if not set, screen is cleared and qrcode is deleted
                - exitCallback: callback after logged out
                    - it contains calling of logout
                - qrCallback: method that should accept uuid, status, qrcode
            for usage
                ..code::python

                    import itchat
                    itchat.auto_login()

            it is defined in components/register.py
            and of course every single move in login can be called outside
                - you may scan source code to see how
                - and modified according to your own demond
        '''
        raise NotImplementedError()
项目:WechatRobot    作者:TaceyWong    | 项目源码 | 文件源码
def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
            enableCmdQR=False, picDir=None, qrCallback=None,
            loginCallback=None, exitCallback=None):
        ''' log in like web wechat does
            for log in
                - a QR code will be downloaded and opened
                - then scanning status is logged, it paused for you confirm
                - finally it logged in and show your nickName
            for options
                - hotReload: enable hot reload
                - statusStorageDir: dir for storing log in status
                - enableCmdQR: show qrcode in command line
                    - integers can be used to fit strange char length
                - picDir: place for storing qrcode
                - loginCallback: callback after successfully logged in
                    - if not set, screen is cleared and qrcode is deleted
                - exitCallback: callback after logged out
                    - it contains calling of logout
                - qrCallback: method that should accept uuid, status, qrcode
            for usage
                ..code::python

                    import itchat
                    itchat.auto_login()

            it is defined in components/register.py
            and of course every single move in login can be called outside
                - you may scan source code to see how
                - and modified according to your own demond
        '''
        raise NotImplementedError()
项目:wx_taobao_fanli    作者:xsren    | 项目源码 | 文件源码
def run(self):
        itchat.auto_login()
        itchat.run()
项目:wx_taobao_fanli    作者:xsren    | 项目源码 | 文件源码
def run(self):
        sysstr = platform.system()
        if (sysstr == "Linux") or (sysstr == "Darwin"):
            itchat.auto_login(enableCmdQR=2, hotReload=True)
        else:
            itchat.auto_login(hotReload=True)
        itchat.run(True)
项目:stock    作者:Rockyzsu    | 项目源码 | 文件源码
def __init__(self, send=None):
        cfg = Toolkit.getUserData('data.cfg')
        self.public_key = cfg['public_key']
        self.private_key = cfg['private_key']
        self.send=send
        from_mail = cfg['from_mail']
        password = cfg['password']
        to_mail = cfg['to_mail']
        smtp_server = 'smtp.qq.com'

        self.server = smtp_server
        self.username = from_mail.split("@")[0]
        self.from_mail = from_mail
        self.password = password
        self.to_mail = to_mail
        self.coin_list=['IFC','DOGE','EAC','DNC','MET','ZET','SKT','YTC','PLC','LKC',
                        'JBC','MRYC','GOOC','QEC','PEB','XRP','NXT','WDC','MAX','ZCC',
                        'HLB','RSS','PGC','RIO','XAS','TFC','BLK','FZ','ANS','XPM','VTC',
                        'KTC','VRC','XSGS','LSK','PPC','ETC','GAME','LTC','ETH','BTC']
        # ???????????????
        # ????????
        if self.send == 'msn':

            try:
                self.smtp = smtplib.SMTP_SSL(port=465)
                self.smtp.connect(self.server)
                self.smtp.login(self.username, self.password)
            except smtplib.SMTPException, e:
                print e
                return 0

        if send=='wechat':
            self.w_name=u'wwwei'
            self.w_name1=u'aiweichuangyi'
            itchat.auto_login(hotReload=True)
            account=itchat.get_friends(self.w_name)
            for i in account:
                if i[u'PYQuanPin']==self.w_name:
                    self.toName= i['UserName']
                    #print self.toName
                if i[u'PYQuanPin']==self.w_name1:
                    self.toName1= i['UserName']
                    #print self.toName