我开始在Scrapy中使用ProxyMesh.ProxyMesh应该在一个端口上提供IP地址池.下面的示例代码代码在循环中重复,中间件启用,总体而言这很好.我可以跟踪(如果是这样 - 如何?)每个特定请求使用哪个IP地址?
request = scrapy.Request(producturl, self.parse_product_info)
request.meta['proxy'] = 'http://uk.proxymesh.com:xxx'
yield request
Run Code Online (Sandbox Code Playgroud)
我在SOF上发现了类似的帖子,但没有解决这个具体问题.
我试图用docker运行haproxy.我按照这里的说明操作:
https://hub.docker.com/_/haproxy/
我能够构建docker镜像但是在尝试运行它之后.
运用
docker run -d --link another_container:another_container --name mc-ha -v haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro my_own_haproxy:latest
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
[ALERT] 298/054910 (1) : [haproxy.main()] No enabled listener found (check for 'bind' directives) ! Exiting.
Run Code Online (Sandbox Code Playgroud)
我搜索了它,但我发现的唯一的东西是ha代理的源代码.
这是我的haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see …Run Code Online (Sandbox Code Playgroud) 所以我正在尝试为我的抓取工具创建一个代理服务器,我不确定为什么我甚至被自己拒绝了.当我在浏览器中访问任何网站时,在我安装了Squid的计算机上以及所有内容上,它给出了以下错误消息:
ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: http://www.whatismyipaddress.com/
The following error was encountered:
Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
Your cache administrator is webmaster.
Generated Sun, 08 Nov 2015 04:03:13 GMT by WIN-AIUOBK0JHPA (squid/2.7.STABLE8)
Run Code Online (Sandbox Code Playgroud)
我在Internet选项中编辑了我的局域网设置以允许代理服务器使用正确的IP地址(当我运行ipconfig时为IPv4),给它打开正确的端口,我也打开了我的端口Windows防火墙.
以下是我的squid.conf文件的部分:
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl …Run Code Online (Sandbox Code Playgroud) 我有一个问题,我们在公司级别设置了一个NTLM代理,但我们有一些我们不拥有的代码不支持NTLM代理.有没有办法创建一个代理来自动传递使用Python所需的NTLM信息?
当脚本在给定时间运行时,我希望能够根据需要直立代理.
这可能吗?任何人都可以提供如何做到这一点的样本吗?样本可以在Python 3.4或2.7中给出.
谢谢阅读!
我一直在努力与我的公司代理一起提出https请求。
import requests
from requests.auth import HTTPProxyAuth
proxy_string = 'http://user:password@url_proxt:port_proxy'
s = requests.Session()
s.proxies = {"http": proxy_string , "https": proxy_string}
s.auth = HTTPProxyAuth(user,password)
r = s.get('http://www.google.com') # OK
print(r.text)
r = s.get('https://www.google.com',proxies={"http": proxy_string , "https": proxy_string}) #OK
print(r.text)
r = s.get('https://www.google.com') # KO
print(r.text)
Run Code Online (Sandbox Code Playgroud)
当KO时,我有以下例外情况:
HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',)))
Run Code Online (Sandbox Code Playgroud)
我在网上看了一下,但没有发现有人遇到HTTPS的特定问题。
感谢您的时间
我设法Jupyterhub在我的服务器上建立并且运行良好.由于我尝试重新启动Jupyterhub服务,它不再工作,当我尝试运行它时,我看到错误消息:
Proxy appears to be running at http://*:8000/, but I can't access it (HTTP 403: Forbidden)
Did CONFIGPROXY_AUTH_TOKEN change?
Run Code Online (Sandbox Code Playgroud)
在我的网络浏览器中
Error 503: Proxy Target Missing.
Run Code Online (Sandbox Code Playgroud)
它可能连接到我每次运行时看到的警告Jupyterhub:
Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
Run Code Online (Sandbox Code Playgroud) 我目前正在运行一个脚本,使用googleapiclient Phyton包(基于httplib2客户端对象)从Google Analytics中提取数据
- >我的脚本完美无需任何代理.
但我必须把它放在我的公司代理之后,所以我需要调整我的httplib2.Http()对象来嵌入代理信息.
在httplib2 doc 1之后,我试过:
pi = httplib2.proxy_info_from_url('http://user:pwd@someproxy:80')
httplib2.Http(proxy_info=pi).request("http://www.google.com")
Run Code Online (Sandbox Code Playgroud)
但它没有用.我总是得到一个超时错误,有或没有代理信息(因此不考虑参数中的proxy_info)
我还在pysocks包(v1.5.6)中下载了socks 并尝试"wrapmodule"httplib2,如下所述:https: //github.com/jcgregorio/httplib2/issues/205
socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, "proxyna", port=80, username='p.tisserand', password='Telematics12')
socks.wrapmodule(httplib2)
h = httplib2.Http()
h.request("http://google.com")
Run Code Online (Sandbox Code Playgroud)
但我得到一个IndexError :(元组索引超出范围)
与此同时,当我使用请求包时,这个简单的代码完美地运行:
os.environ["HTTP_PROXY"] = "http://user:pwd@someproxy:80"
req = requests.get("http://www.google.com")
Run Code Online (Sandbox Code Playgroud)
问题是需要符合googleapiclient要求并提供htpplib2.Http()客户端对象.
proxy google-api httplib2 google-analytics-api python-requests
我正在使用带有ARR和URL重写的IIS作为反向代理,以支持与ElasticSearch服务器的HTTPS连接.据我所知,ES已正确配置,并且与ES的直接HTTP连接不会导致错误.
但是,当我通过代理连接时,我在浏览器中收到此错误:
跨源请求已阻止:同源策略禁止在https:// myserver:19201/myindex/_search读取远程资源.(原因:在CORS预检频道的CORS标题'Access-Control-Allow-Headers'中遗漏了令牌'授权')
elasticsearch.yml文件的相关部分是这样的:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: ["X-Requested-With","X-Auth-Token","Content-Type","Content-Length","Authorization","engine-name"]
http.cors.allow-credentials: true
Run Code Online (Sandbox Code Playgroud)
有什么特别的东西我需要通过代理启用这些请求,或者这是一个傻瓜的差事,我应该寻找另一种选择?
proxy ×10
python ×4
http ×2
squid ×2
atom-editor ×1
cors ×1
docker ×1
electron ×1
google-api ×1
haproxy ×1
http-proxy ×1
httplib2 ×1
iis ×1
javascript ×1
jupyterhub ×1
node.js ×1
python-2.7 ×1
python-3.x ×1
request ×1
scrapy ×1
web-scraping ×1