Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有想到原因,求解 #13

Open
fengyan-cn opened this issue Feb 18, 2020 · 1 comment
Open

没有想到原因,求解 #13

fengyan-cn opened this issue Feb 18, 2020 · 1 comment

Comments

@fengyan-cn
Copy link

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4_init_.py", line 287, in init
elif len(markup) <= 256 and (
TypeError: object of type 'NoneType' has no len()

@UnlightedOtaku
Copy link

也不放具体代码,神仙能给你定位问题。。。
我自己做的时候出现这个情况是因为爬的网站(豆瓣)做了简单反爬,需要给程序加一个headers
比如:
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'}
response = requests.get(url,headers = headers)

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

No branches or pull requests

2 participants