Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.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_Python_Python 3.x_Python Requests - Fatal编程技术网

使用请求请求页面时出错。获取python

使用请求请求页面时出错。获取python,python,python-3.x,python-requests,Python,Python 3.x,Python Requests,我正在尝试获取supreme主页的html来解析它。 以下是我正在尝试的: from bs4 import BeautifulSoup all_page = requests.get('https://www.supremenewyork.com/index', headers = { 'Upgrade-Insecure-Requests': '1', 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWeb

我正在尝试获取supreme主页的html来解析它。 以下是我正在尝试的:

from bs4 import BeautifulSoup

all_page = requests.get('https://www.supremenewyork.com/index', headers = {
    'Upgrade-Insecure-Requests': '1',
    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
    }).text
all_page_html = BeautifulSoup(all_page,'html.parser')
print(all_page_html)
但我得到的不是html,而是以下响应:

<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"/><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/><title>Supreme</title><meta content="Supreme. The official website of Supreme. EST 1994. NYC." name="description"/><meta content="telephone=no" name="format-detection"/><meta content="on" http-equiv="cleartype"/><meta content="notranslate" name="google"/><meta content="app-id=664573705" name="apple-itunes-app"/><link href="//www.google-analytics.com" rel="dns-prefetch"/><link href="//ssl.google-analytics.com" rel="dns-prefetch"/><link href="//d2flb1n945r21v.cloudfront.net" rel="dns-prefetch"/><script src="https://www.google.com/recaptcha/api.js">async defer</script><meta content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" id="viewport" name="viewport"/><link href="//d17ol771963kd3.cloudfront.net/assets/application-2000eb9ad53eb6df5a7d0fd8c85c0c03.css" media="all" rel="stylesheet"/><script \
e.t.c


Supremeasync-defer嗯,页面实际上就是这样的。这意味着它是一个包含css和javascript的HTML页面,然后您应该使用“Inspect元素”搜索您想要获取的元素,并可能写下它们存储在的类,以便更容易地找到它们。

它说的是
,所以我认为它是HTML。但是检查所需页面的HTML代码它是不同的这是什么错误?不是错误,我的意思是,如果我打开
https://www.supremenewyork.com/index
在我的web浏览器中,查看页面源代码,我得到的正是您在问题中显示的内容。