Celery或urllib3将我重定向到https

问题描述 投票:0回答:1

我在通过urllib3发出请求时遇到问题。因此,我正在通过代理连接并运行脚本槽芹菜。

urllib3设置:self.http = urllib3.ProxyManager('http://127.0.0.1:24000')

Urllib3请求:page = self.http.request('get', self.start_url, headers=self.headers)

之后,我在芹菜日志中看到了这样的内容:

[2019-11-19 16:13:54,038: INFO/ForkPoolWorker-2] Redirecting http://www.olx.pl/nieruchomosci/mieszkania/wynajem/wroclaw/ -> https://www.olx.pl/nieruchomosci/mieszkania/wynajem/wroclaw/

如何禁用此重定向?

django celery django-celery urllib3
1个回答
0
投票

不是urllib3或celery,它是远程服务器。

$ curl -D- http://www.olx.pl/nieruchomosci/mieszkania/wynajem/wroclaw/
HTTP/1.1 301 Moved Permanently
Content-Length: 0
Location: https://www.olx.pl/nieruchomosci/mieszkania/wynajem/wroclaw/
Expires: Tue, 19 Nov 2019 16:33:49 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Tue, 19 Nov 2019 16:33:49 GMT
Connection: keep-alive
Server: OLXcdn
X-T: True

如您所见,服务器正在将您重定向到HTTPS,因此您不能在客户端禁用它。

© www.soinside.com 2019 - 2024. All rights reserved.