python - 没有从python中的请求中获取数据
问题描述
我试图从在线商店获取产品信息。它不需要任何类型的身份验证。我可以从浏览器中看到产品信息。我在开发人员工具中进行了检查,发现了从URL获取数据的请求。我的python代码如下
import requests
def coles():
URL = "https://shop.coles.com.au/search/resources/store/20520/productview/bySeoUrlKeyword/mutti-tomato-passata-2349503p"
PARAMS = {
"catalogId": 12064
}
res = requests.get(URL,PARAMS)
print(res.text)
#coles()
if __name__ == '__main__':
coles()
但我得到的是这个而不是产品信息
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="about:blank">
</head>
<body>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/j.js"></script>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/f.js"></script>
<script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint/script/kpf.js?url=/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint&token=dcc221cb-d87a-e9e3-5316-7c7a20910bf8"></script>
</body>
</html>
但是在检查中,我得到了这样的东西。也许我需要添加一些标题信息或遗漏一些东西。
如果我将此请求 URL放在浏览器中,我会得到数据。
解决方案
推荐阅读
- android - CodenameOne - android.buildToolsVersion=27 的 Android 权限错误
- php - 在 AWS AMI 实例上使用 PHPMailer 发送邮件时出现问题
- ios - 加载时集合视图未从索引 0 开始
- python - 如何测量图像中的颜色接近度/浓度?(首选python解决方案)
- vba - 在 3 列中查找重复值
- spring - Spring Batch:多个作者
- python - 从动态类中获取数据=“??????” 从 bs4
- java - 我在下面运行一个循环。它会自动跳过第一次运行并给我一个答案“无效条目”
- java - 使用带有 RecyclerView 的 Boom Menu 时应用程序崩溃
- html - 添加背景图像后,部分 CSS 将无法工作