def loginAndPostMessage(self, present_website, VPN: str):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            Session = get_Session(VPN)
            if Session == -1:
                self.failed_count = self.failed_count + 1
                continue

            # 从数据库中获取用户信息
            userInfo = generate_login_data(present_website)
            g_var.logger.info(userInfo)
            if userInfo == None:
                g_var.ERR_CODE = 2001
                g_var.ERR_MSG = g_var.ERR_MSG + "无法获取proxy!"
                g_var.logger.error("数据库中获取用户失败,本线程停止!")
                return -1

            # 1、登录
            login_signal = 0
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                loginData = self.login(Session, present_website, VPN, userInfo)
                if loginData == 1:
                    # 返回1表示登录失败,将数据库中的status改为异常
                    g_var.logger.info('使用当前账号密码登录失败。。。')
                    sql = "UPDATE" + present_website + "SET status=1 WHERE id=" + str(
                        userInfo[0]) + ";"
                    status = MysqlHandler().update(sql)
                    if status == -1:
                        return -1
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                elif loginData == 0:
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                elif loginData == -1:
                    # 代理问题,更换代理
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif loginData == -2:
                    g_var.logger.info("登录失败,但可以使用此账户继续尝试,不跳出循环")
                    self.failed_count = self.failed_count + 1
                    continue
                else:
                    self.failed_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break
            if login_signal == 1:
                continue

            # 2、发文章
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                time.sleep(g_var.SLEEP_TIME)
                retry_count = retry_count + 1
                status = self.__postMessage(Session, loginData,
                                            present_website)
                if status == 'ok':  # 发文章成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    break
                elif status == 1:
                    sql = "UPDATE " + present_website + " SET cookie='' WHERE id=" + str(
                        loginData['id']) + ";"
                    status = MysqlHandler().update(sql)
                    if status == 0:
                        g_var.logger.info("cookie失效,清除cookie update OK")
                    else:
                        g_var.logger.error("数据库清除cookie错误!")
                    self.failed_count = self.failed_count + 1
                    break
                elif status == 0:
                    self.failed_count = self.failed_count + 1
                    break
                elif status == -1:
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif status == -2:
                    self.failed_count = self.failed_count + 1
                    continue
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续发文章出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "篇文章")
Esempio n. 2
0
    def loginAndPostMessage(self, present_website, VPN):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            # 1、登录
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                # 从数据库中获取用户信息
                userInfo = generate_login_data(present_website)
                g_var.logger.error('...userInfo...')
                g_var.logger.error(userInfo)
                if userInfo == None:
                    g_var.logger.error("数据库中获取用户失败,本线程停止!")
                    return {"error": -1}
                else:
                    loginData = self.__login(VPN, userInfo)
                    if loginData == -1:
                        # 登录报错,停止运行\
                        g_var.logger.error("登录出错,更换代理。。。")
                        g_var.ERR_MSG = "登录出错"
                        self.failed_count = self.failed_count + 1
                        time.sleep(g_var.SLEEP_TIME)
                        proxies = ip_proxy(VPN)
                        Session.proxies = proxies
                        continue
                    elif loginData == 1:
                        # 账号异常,重新取新账号登录
                        self.failed_count = self.failed_count + 1
                        continue
                    else:
                        self.failed_count = 0
                        self.proxy_err_count = 0
                        break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续注册出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break

            # 2、发链接
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                status = self.__postMessage(loginData)
                if status == 0:  # 发链接成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
                elif status == 1:
                    self.failed_count = self.failed_count + 1
                    self.proxy_err_count = self.proxy_err_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    Session.proxies = proxies
                    # g_var.logger.info("proxies"+str(proxies))
                elif status == -1:
                    # 获取不到链接,程序停止
                    self.failed_count = self.failed_count + 1
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续发文章出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "个链接")
Esempio n. 3
0
    def loginAndPostMessage(self, present_website, VPN: str):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            Session = get_Session(VPN)
            if Session == -1:
                self.failed_count = self.failed_count + 1
                continue

            # 从数据库中获取用户信息
            userInfo = generate_login_data(present_website)
            g_var.logger.info(userInfo)
            if userInfo == None:
                g_var.ERR_CODE = 2001
                g_var.ERR_MSG = g_var.ERR_MSG + "无法获取proxy!"
                g_var.logger.error("数据库中获取用户失败,本线程停止!")
                return -1

            # 1、登录
            login_signal = 0
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1

                loginData = self.login(Session, present_website, VPN, userInfo)
                if loginData == -1:
                    # 代理问题,更换代理
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif loginData == -2:
                    # 账号异常,跳出本循环
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                else:
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break
            if login_signal == 1:
                continue

            # 2、发文章
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                time.sleep(g_var.SLEEP_TIME)
                retry_count = retry_count + 1
                status = self.__postMessage(Session, loginData,
                                            present_website)
                if status == 0:  # 发文章成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
                elif status == -1:
                    # 返回值为-1,更换代理
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif status == -2:
                    # 返回值为-1,某些必须停止的错误,程序停止
                    self.failed_count = self.failed_count + 1
                    g_var.SPIDER_STATUS = 3
                    break
                elif status == -3:
                    self.failed_count = self.failed_count + 1
                elif status == -4:
                    sql = "UPDATE %s SET cookie=null WHERE id=%s ;" % (
                        present_website, loginData["id"])
                    g_var.logger.info(sql)
                    status = MysqlHandler().update(sql)
                    if status != 0:
                        g_var.logger.error("数据库清除cookie错误!")
                        return {"error": 1}
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续发文章出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "篇文章")
    def loginAndPostMessage(self, present_website, VPN):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            Session = get_Session(VPN)
            if Session == -1:
                self.failed_count = self.failed_count + 1
                continue

            userInfo = generate_login_data(present_website)
            if userInfo == None:
                g_var.logger.error("数据库中获取用户失败,本线程停止!")
                return {"error": -1}
            # 1、登录
            retry_count = 0
            login_signal = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                loginData = self.__login(Session, VPN, userInfo)
                if loginData == -1:
                    # 登录报错,停止运行
                    g_var.ERR_MSG = "登录出错"
                    self.failed_count = self.failed_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    Session.proxies = proxies
                    continue
                elif loginData == 1:
                    # 账号异常,重新取新账号登录
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                else:
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break

            if login_signal == 1:
                continue
            # 2、获取个人数据
            retry_count = 0
            personal_signal = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                personalData = self.__personal_data(Session, loginData)
                if personalData == -1:
                    g_var.ERR_MSG = "个人数据获取出错"
                    self.failed_count = self.failed_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    Session.proxies = proxies
                    continue
                elif personalData == 1:
                    # 账号异常,重新取新账号登录
                    self.failed_count = self.failed_count + 1
                    personal_signal = 1
                    break
                else:
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break

            if personal_signal == 1:
                continue

            # 3、发链接
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                status = self.__postMessage(Session, loginData, personalData)
                if status == 0:  # 发链接成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
                elif status == 1:
                    self.failed_count = self.failed_count + 1
                    self.proxy_err_count = self.proxy_err_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    Session.proxies = proxies
                    continue
                elif status == -1:
                    # 获取不到链接,程序停止
                    self.failed_count = self.failed_count + 1
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续发链接出错,程序停止"
                g_var.logger.error("连续发链接出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "个链接。")
Esempio n. 5
0
    # args = get_command_line_arguments()
    g_var.ALL_COUNT = count
    g_var.INTERFACE_HOST = host
    g_var.UUID = uuid
    # 获取配置参数
    get_global_params(present_website, True)

    # 1、注册测试
    # PastebinCom(1).registers(present_website, VPN)

    # 2、登录测试
    # s = requestsW.session()
    # userInfo = generate_login_data(present_website, "D:\qianwei_gitrepo\SendArticle\pastebin_com\config.json") #网站下json绝对路径
    # loginData = PastebinCom(1).login(s, present_website, VPN, userInfo)

    # 3、发送文章测试
    s = requestsW.session()
    s.proxies = ip_proxy("en")
    userInfo = generate_login_data(
        present_website,
        "D:\qianwei_gitrepo\SendArticle\pastebin_com\config.json"
    )  #网站下json绝对路径
    loginData = {
        'id': userInfo[0],
        'username': userInfo[1],
        'password': userInfo[2],
        'email': userInfo[3],
        'cookie': eval(userInfo[5]),
    }
    PastebinCom(1).send_profile(s, loginData)
Esempio n. 6
0
    def loginAndPostMessage(self, VPN: str):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            Session = requests.Session()
            # 获取代理设置
            proxies = ip_proxy(VPN)
            if proxies == {"error": -1}:
                self.failed_count = self.failed_count + 1
                continue

            Session.proxies = proxies
            Session.mount('http://', HTTPAdapter(max_retries=1))
            Session.mount('https://', HTTPAdapter(max_retries=1))

            # 1、登录
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                # 从数据库中获取用户信息
                userInfo = generate_login_data("reddit_com")
                if userInfo == None:
                    g_var.logger.error("数据库中获取用户失败,本线程停止!")
                    return {"error": -1}
                else:
                    loginData = self.__login(Session, VPN, userInfo)
                    if loginData == {"error": -1}:
                        # 登录报错,停止运行
                        g_var.ERR_MSG = "登录出错"
                        self.failed_count = self.failed_count + 1
                        time.sleep(g_var.SLEEP_TIME)
                        proxies = ip_proxy(VPN)
                        Session.proxies = proxies
                        continue
                    elif loginData == {"error": 1}:
                        # 账号异常,重新取新账号登录
                        self.failed_count = self.failed_count + 1
                        continue
                    else:
                        self.failed_count = 0
                        self.proxy_err_count = 0
                        break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break

            # 2、发文章
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                status = self.__postMessage(Session, loginData)
                if status == {"ok": 0}:  # 发文章成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
                elif status == {"error": 1}:
                    self.failed_count = self.failed_count + 1
                    self.proxy_err_count = self.proxy_err_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    Session.proxies = proxies
                    # g_var.logger.info("proxies"+str(proxies))
                elif status == {"error": -1}:
                    # 获取不到文章,程序停止
                    self.failed_count = self.failed_count + 1
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续发文章出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "篇文章")
    host = "http://192.168.31.234:8080"
    count = 10
    # 获取命令行传入参数
    # args = get_command_line_arguments()
    g_var.ALL_COUNT = count
    g_var.INTERFACE_HOST = host
    g_var.UUID = uuid
    # 获取配置参数
    get_global_params(present_website, True)
    #注册测试
    # DiigoCom(3).registers(present_website,VPN)

    ##登录测试
    # s = requestsW.session()
    # userInfo = generate_login_data(present_website,"网站json/config.json")#网站下json绝对路径
    # loginData = DiigoCom(3).login(s, present_website, VPN, userInfo)

    ##发送文章测试
    userInfo = generate_login_data(
        present_website,
        "/Users/a/Desktop/python/spider/web2_shezhen/SendArticle/diigo_com/config.json"
    )  #网站下json绝对路径
    DiigoCom(1).loginAndPostMessage(present_website, VPN)

    # s=requestsW.session()
    # s.proxies=ip_proxy("en")
    # rlist=[]
    # for i in range(15):
    #     r=register_one(s)
    #     rlist.append(r)
    # print(rlist)
Esempio n. 8
0
    def loginAndPostMessage(self, present_website, VPN):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            Session = get_Session(VPN)
            if Session == -1:
                self.failed_count = self.failed_count + 1
                continue

            # 从数据库中获取用户信息
            userInfo = generate_login_data(present_website)
            g_var.logger.info(userInfo)
            if userInfo == None:
                g_var.ERR_CODE = 2001
                g_var.ERR_MSG = g_var.ERR_MSG + "无法获取proxy!"
                g_var.logger.error("数据库中获取用户失败,本线程停止!")
                return -1

            # 1、登录
            login_signal = 0
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1

                loginData = self.__login(Session, present_website, VPN,
                                         userInfo)
                if loginData == -1:
                    # 代理问题,更换代理
                    g_var.ERR_MSG = "登录出错"
                    self.failed_count = self.failed_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    if proxies == {"error": -1}:
                        self.failed_count = self.failed_count + 1
                        continue
                    Session.proxies = proxies
                    continue
                elif loginData == -2:
                    # 账号异常,跳出本循环
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                else:
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续登录出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break
            if login_signal == 1:
                continue

            # 2、发文章
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                time.sleep(g_var.SLEEP_TIME)
                retry_count = retry_count + 1
                status = self.__postMessage(Session, loginData,
                                            present_website)
                if status == 0:  # 发文章成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    self.proxy_err_count = 0
                    break
                elif status == -1:
                    # 返回值为-1,更换代理
                    self.failed_count = self.failed_count + 1
                    self.proxy_err_count = self.proxy_err_count + 1
                    time.sleep(g_var.SLEEP_TIME)
                    proxies = ip_proxy(VPN)
                    if proxies == {"error": -1}:
                        self.failed_count = self.failed_count + 1
                        continue
                    Session.proxies = proxies
                    # g_var.logger.info("proxies"+str(proxies))
                elif status == -2:
                    # 返回值为-1,某些必须停止的错误,程序停止
                    self.failed_count = self.failed_count + 1
                    g_var.SPIDER_STATUS = 3
                    break
                elif status == -3:
                    # 返回值为-1,数据库错误
                    self.failed_count = self.failed_count + 1
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = "连续发文章出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "篇文章")
    def loginAndPostMessage(self, present_website, VPN):
        while self.success_count < self.assignment_num:
            # 每次循环检测当前错误状态
            if self.__monitor_status() == -1:
                break
            self.now_count = self.now_count + 1

            # 从数据库中获取用户信息
            userInfo = generate_login_data(present_website)
            g_var.logger.info(userInfo)
            if userInfo == None:
                g_var.ERR_CODE = 2003
                g_var.ERR_MSG = g_var.ERR_MSG + "无法获取正常用户!"
                g_var.logger.error("数据库中获取用户失败,本线程停止!")
                return -1
            # 1、登录
            login_signal = 0
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                retry_count = retry_count + 1
                googlekey = get_googlekey()
                if googlekey == -1:
                    g_var.ERR_CODE = 2001
                    g_var.ERR_MSG = g_var.ERR_MSG + "无法获取googleKey值..."
                    g_var.logger.info("获取googlekey值失败...")
                    continue
                loginData = self.__login(present_website, VPN, userInfo,
                                         googlekey)
                if loginData == -1:
                    # 代理问题,更换代理
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif loginData == -2:
                    # 账号异常,跳出本循环
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                elif loginData == 0:
                    # cookie存库失败
                    g_var.logger.info("cookie存库失败!")
                    self.failed_count = self.failed_count + 1
                    login_signal = 1
                    break
                else:
                    self.failed_count = 0
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续注册出错,程序停止"
                g_var.logger.error("login:连续登录失败!程序停止")
                break
            if login_signal == 1:
                continue

            # 2、发文章
            retry_count = 0
            while retry_count < g_var.RETRY_COUNT_MAX:
                time.sleep(g_var.SLEEP_TIME)
                retry_count = retry_count + 1
                status = self.__postMessage(loginData, present_website,
                                            googlekey)
                if status == 0:  # 发文章成功
                    self.success_count = self.success_count + 1
                    self.failed_count = 0
                    break
                elif status == -1:
                    # 返回值为-1,更换代理
                    g_var.ERR_MSG = g_var.ERR_MSG + "|_|代理连续错误"
                    g_var.logger.info("代理错误")
                    retry_count = g_var.RETRY_COUNT_MAX
                elif status == -2:
                    # 返回值为-1,某些必须停止的错误,程序停止
                    self.failed_count = self.failed_count + 1
                    g_var.SPIDER_STATUS = 3
                    break
                elif status == -3:
                    # 返回值为-1,数据库错误
                    self.failed_count = self.failed_count + 1
                    break
                elif status == -4:
                    # cookie失效,结束此次发送
                    self.failed_count = self.failed_count + 1
                    break
            if retry_count == g_var.RETRY_COUNT_MAX:
                # 连续出错说明发生了一些问题,需要停止程序
                g_var.SPIDER_STATUS = 3
                g_var.ERR_MSG = g_var.ERR_MSG + "|_|连续注册出错,程序停止"
                g_var.logger.error("连续发文章出错,程序停止")
                break
        g_var.logger.info("成功发送" + str(self.success_count) + "篇文章")