Skip to content

Redirect issue requests not passing proxies through to redirect #3895

Closed
@toasteez

Description

@toasteez

I'm trying to retrieve data via Quandl from behind a proxy.

The reason I have dropped into requests is that the Quandl library does not allow a proxy dictionary to be passed.

I can successfully retrieve datasets where there is no redirect however when you try to retrieve a complete database there is a redirect

from https://www.quandl.com/api/v3/databases/CLSM/data?api_key ... (cannot provide my private key)

to - https://quandl-bulk-download.s3.amazonaws.com/CLSM.zip? ..... (Amazon credentials are created here)

Code

response = requests.get(url, proxies=proxies, allow_redirects=False) # This lets me see the headers, without failing 

response = requests.get(url, proxies=proxies) # This fails OSError: Tunnel connection failed: 407 Proxy Authentication Required

The initial request returns a status 302.

{'X-Runtime': '0.079339', 'X-XSS-Protection': '1; mode=block', 'Connection': 'keep-alive', 'Content-Length': '1059', 'Cache-Control': 'no-cache', 'X-RateLimit-Remaining': '999901', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Location': 'https://quandl-bulk-download.s3.amazonaws.com/CLSM.zip?...SignedHeaders=host&X-Amz-Signature=... , 'X-Frame-Options': 'SAMEORIGIN', 'X-Rack-CORS': 'preflight-hit; no-origin', 'CF-RAY': '...., 'Set-Cookie': '__cfduid=...; expires=Wed, 28-Feb-18 10:00:16 GMT; path=/; domain=.quandl.com; HttpOnly', 'Server': 'cloudflare-nginx', 'Content-Type': 'text/html; charset=utf-8', 'Date': 'Tue, 28 Feb 2017 10:00:17 GMT', 'X-RateLimit-Limit': '1000000', 'X-Request-Id': ...}

Is there still a bug in this area or should I be doing something differently?

Note that IE prompts for download of file and Chrome just works.

Version
Python 3.5.2
requests 2.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions