Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

有个小问题 #26

Open
zsp00 opened this issue Oct 22, 2019 · 5 comments
Open

有个小问题 #26

zsp00 opened this issue Oct 22, 2019 · 5 comments

Comments

@zsp00
Copy link

zsp00 commented Oct 22, 2019

偶尔报这个,这破网站的缘故吧
image
你看怎么处理更好,我临时这么写处理了下

    def get_details(self, url, muti, name, page, index_str, referer_url):
        bs_data = ''
        while True:
            resp = self.session.get(
                url, headers={"Referer": referer_url, "Cookie": self.get_cookie_string()}
            )
            info(resp.headers.get("Set-Cookie", ""))
            resp.encoding = "utf8"
            if not self.check_if_need_relogin(resp):
                return

            bs_data = bs_4(resp.text, "lxml")
            if bs_data.select_one('title').text != '出错了.':
                break
            else:
                warning('重新获取一次')
@s045pd
Copy link
Owner

s045pd commented Oct 22, 2019

稍等我看下

@s045pd
Copy link
Owner

s045pd commented Oct 22, 2019

我建议这个循环最好有个次数限定,指不定会一直在这里卡住

@zsp00
Copy link
Author

zsp00 commented Oct 23, 2019

也是,我加个次数

@zsp00
Copy link
Author

zsp00 commented Oct 23, 2019

暗网又凉了

@s045pd
Copy link
Owner

s045pd commented Oct 23, 2019

正常的变动应该不会太大 等等看就好了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants