Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Cloudflare清理,查找元素_Python_Html_Web Scraping_Beautifulsoup_Cloudflare - Fatal编程技术网

Python Cloudflare清理,查找元素

Python Cloudflare清理,查找元素,python,html,web-scraping,beautifulsoup,cloudflare,Python,Html,Web Scraping,Beautifulsoup,Cloudflare,我一直在玩cfscrape模块,它允许您绕过站点上的cloudflare验证码保护。。。我已经访问了页面的内容,但似乎无法让代码正常工作,而是打印了整个HTML。我只想在 我省略了代码中一些不相关的部分 try: page = urllib2.urlopen(req) content = page.read() except urllib2.HTTPError, e: print("hi") 您应该阅读包含html代码的urlopen对象 您应该将content变量放在

我一直在玩cfscrape模块,它允许您绕过站点上的cloudflare验证码保护。。。我已经访问了页面的内容,但似乎无法让代码正常工作,而是打印了整个HTML。我只想在

我省略了代码中一些不相关的部分

try:
    page = urllib2.urlopen(req)
    content = page.read()
except urllib2.HTTPError, e:
    print("hi")
您应该阅读包含html代码的urlopen对象


您应该将
content
变量放在except之前

您是否熟悉
ConnectionError:('Connection aborted.',BadStatusLine
错误?不确定我为什么会收到此消息。@ColeWorld您应该发布其他问题,而不是在评论中提出新问题。请接受此答案以结束此问题。
try:
    page = urllib2.urlopen(req)
    content = page.read()
except urllib2.HTTPError, e:
    print("hi")