请更改您的浏览器设置或升级您的浏览器( urllib, python 3.6)
Please change your browser settings or upgrade your browser ( urllib, python 3.6)
晚上好,
我的 urllib 代码在使用 javascript 的网站上有错误。
这是我得到的错误:
"This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser".
我正在使用 python 3.6 和 urllib(请求),我该如何解决它?
您正在访问的网站需要 javascript 和 cookie。 urllib 仅提供对 cookie 的支持(with cookie jar). To get around the need for javascript, check out a library like selenium, and use it with phantomjs.
pip install selenium
带有 phantomjs 的 Selenium 比 urllib 更强大,但你付出的代价是它有点慢。这是使用 selenium 和 phantomjs 的一些简单代码:
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get("https://google.com/")
driver.quit()
有关如何使用 selenium 执行特定操作的更多信息,请查看 documentation。
晚上好,
我的 urllib 代码在使用 javascript 的网站上有错误。
这是我得到的错误:
"This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser".
我正在使用 python 3.6 和 urllib(请求),我该如何解决它?
您正在访问的网站需要 javascript 和 cookie。 urllib 仅提供对 cookie 的支持(with cookie jar). To get around the need for javascript, check out a library like selenium, and use it with phantomjs.
pip install selenium
带有 phantomjs 的 Selenium 比 urllib 更强大,但你付出的代价是它有点慢。这是使用 selenium 和 phantomjs 的一些简单代码:
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get("https://google.com/")
driver.quit()
有关如何使用 selenium 执行特定操作的更多信息,请查看 documentation。