def get_verify_code(self, file_path):
        """
        获取登录验证码并存储
        :param file_path: 将验证码图片保存的文件路径
        """
        url = 'https://mp.weixin.qq.com/cgi-bin/verifycode'
        payload = {
            'username': self.__username,
            'r': int(random.random() * 10000000000000),
        }
        headers = {
            'referer': 'https://mp.weixin.qq.com/',
        }
        r = requests.get(url, data=payload, headers=headers, stream=True)

        self.__cookies = ''
        for cookie in r.cookies:
            self.__cookies += cookie.name + '=' + cookie.value + ';'

        with open(file_path, 'wb') as fd:
            for chunk in r.iter_content(1024):
                fd.write(chunk)
def get_verify_code(self, file_path):
        """
        获取登录验证码并存储
        :param file_path: 将验证码图片保存的文件路径
        """
        url = 'https://mp.weixin.qq.com/cgi-bin/verifycode'
        payload = {
            'username': self.__username,
            'r': int(random.random() * 10000000000000),
        }
        headers = {
            'referer': 'https://mp.weixin.qq.com/',
        }
        r = requests.get(url, data=payload, headers=headers, stream=True)

        self.__cookies = ''
        for cookie in r.cookies:
            self.__cookies += cookie.name + '=' + cookie.value + ';'

        with open(file_path, 'wb') as fd:
            for chunk in r.iter_content(1024):
                fd.write(chunk)
def get_verify_code ( self , file_path ) : url = 'https://mp.weixin.qq.com/cgi-bin/verifycode' payload = { 'username' : self . __username , 'r' : int ( random . random ( ) * 10000000000000 ) , } headers = { 'referer' : 'https://mp.weixin.qq.com/' , } r = requests . get ( url , data = payload , headers = headers , stream = True ) self . __cookies = '' for cookie in r . cookies : self . __cookies += cookie . name + '=' + cookie . value + ';' with open ( file_path , 'wb' ) as fd : for chunk in r . iter_content ( 1024 ) : fd . write ( chunk )
获取登录验证码并存储
        :param file_path: 将验证码图片保存的文件路径
获取登录验证码并存储 : param file_path : 将验证码图片保存的文件路径