在 javascript 页面中使用 python 请求 [英] Using python Requests with javascript pages

查看:34
本文介绍了在 javascript 页面中使用 python 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将请求框架与 python (http://docs.python-requests.org/en/latest/) 但我试图访问的页面使用 javascript 来获取我想要的信息.

I am trying to use the Requests framework with python (http://docs.python-requests.org/en/latest/) but the page I am trying to get to uses javascript to fetch the info that I want.

我曾尝试在网络上搜索解决方案,但事实上我使用关键字 javascript 进行搜索,我得到的大部分内容是如何使用 javascript 语言进行抓取.

I have tried to search on the web for a solution but the fact that I am searching with the keyword javascript most of the stuff I am getting is how to scrape with the javascript language.

是否可以将请求框架与使用 javascript 的页面一起使用?

Is there anyway to use the requests framework with pages that use javascript?

推荐答案

您将不得不发出 javascript 发出的相同请求(使用 Requests 库).您可以使用任意数量的工具(包括 Chrome 和 Firefox 中内置的工具)来检查来自 javascript 的 http 请求,并且只需自己从 Python 发出此请求.

You are going to have to make the same request (using the Requests library) that the javascript is making. You can use any number of tools (including those built into Chrome and Firefox) to inspect the http request that is coming from javascript and simply make this request yourself from Python.

这篇关于在 javascript 页面中使用 python 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆