auto_vote.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Python 作者: Guzi219 项目源码 文件源码
def main_process(self, topicId):
        # print id
        reqdata = {'liveId': topicId}
        # ?????
        reqheaders = {'Content-type': 'application/x-www-form-urlencoded',
                      'Accept': 'application/json',
                      'Host': 'h5-zb.leju.com',
                      'X-Requested-With': 'XMLHttpRequest',
                      'Origin': 'http://h5-zb.leju.com',
                      'Referer': 'http://zhichang.renren.com',
                      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0',}
        #'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', }
        time.sleep(random.random())

        while True:
            nowTime =  time.ctime()
            r = requests.post(self.url, data=reqdata, headers=reqheaders)
            msg =  '====' + topicId +'===='
            tmpDict = r.json()
            if ('errorMsg' in tmpDict):
                errMsg = tmpDict['errorMsg']
                print (nowTime + msg + errMsg)
            if ('result' in tmpDict):
                print (nowTime + msg + str(tmpDict['result']))

            time.sleep(60.33);
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号