首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Scrapy-Splash如何实现代理配置文件?

Scrapy-Splash如何实现代理配置文件?
EN

Stack Overflow用户
提问于 2017-07-13 17:36:27
回答 1查看 1.1K关注 0票数 3

我在使用Scrapy-Splash和HTTP proxy (参见"500 Internal Server Error" when combining Scrapy over Splash with an HTTP proxy)时遇到了一些问题,即使我试图在http://splash.readthedocs.io/en/latest/api.html#proxy-profiles之后设置一个代理配置文件。

为了更好地理解发生了什么,我正在寻找Scrapy-Splash源代码的一部分,https://github.com/scrapy-plugins/scrapy-splash,它解析/etc/splash/proxy-profiles中的.ini文件中指定的代理hostport

然而,在存储库中搜索"proxy“或".ini”没有得到任何结果。有人能给我解释一下代理分析是如何在Scrapy-Splash中实现的吗?

EN

回答 1

Stack Overflow用户

发布于 2017-11-08 13:49:27

首先,Scrapy-Splash代理设置是在/etc/splash/proxy-profiles中设置的,但是如果您在容器中运行splash,您可以通过-v将主机代理配置文件映射到容器,例如:

代码语言:javascript
复制
sudo docker run -p 8050:8050 -v /etc/splash/proxy-profiles:/etc/splash/proxy-profiles scrapinghub/splash

第二,当通过splash访问url时,如果proxy profile名称不是default.ini,则需要一个proxy参数,例如:

代码语言:javascript
复制
localhost:8050/render.html?url=http://target.com?wait=1&timeout=2&proxy=filename
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45076817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档