Burza
Burza

Reputation: 47

Celery or urllib3 is redirecting me to https

I have a problem with making requests trough urllib3. So, I'm connecting through proxy and running script trough celery.

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

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

And after that I see in celery logs something like this:

[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/

How can I disable this redirect?

Upvotes: 0

Views: 100

Answers (1)

Vinay Pai
Vinay Pai

Reputation: 7758

It's not urllib3 or celery, it's the remote server.

$ 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

As you can see there the server is redirecting you to HTTPS, so you can't disable this on the client side.

Upvotes: 1

Related Questions