-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect issue requests not passing proxies through to redirect #3895
Comments
It seems like your proxy requires that you authorize to it. Do you have credentials for that proxy? |
The proxy auto authorizes for a simple dataset request via quandl but not for the redirect. I tested this by removing the proxies=proxies (the request fails) witha MaxRetryError: HTTPSConnectionPool(host='www.quandl.com', port=443): With the proxy dict it is successful. (this is without a redirect to amazon) I'm on windows so it uses either Kerberos or NTLM not sure which? |
Requests does not transparently support Kerberos or NTLM. You'd need to use something like requests-kerberos or requests-ntlm to support those auth challenges. However, I don't think either support authing to CONNECT tunnelling proxies via those protocols. |
Why would 1st connection to quandl.com authenticate via proxy automatically but the redirect does not? |
@toasteez Can you show me the proxy dictionary? |
proxies = {'http': 'http://proxy.company.org:8080', |
So, my best guess is that the first request does not need auth because the proxy server has decided that requests to that hostname (www.quandl.com) do not need authorization, while requests to the second hostname (which belongs to Amazon) do. That is, that this is a proxy concern. |
OK. Thanks. How do I pass the auth and pw via requests to try this out? My preferred option is to make this seamless without hard coding my credentials anywhere though. |
If you can auth to the proxy using basic auth you need to pass them in the URL to the proxy, e.g. |
Or could this be wrapped up somehow to work? import win32com.client url = 'https://...' h = win32com.client.Dispatch('WinHTTP.WinHTTPRequest.5.1') |
It's not at all clear to me what you're trying to do with the above code. |
Ignoring the above the adding the user:password to the proxy results in: SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",) |
Ok, so it looks very much like the proxy is attempting to place itself as a man-in-the-middle on your HTTPS connection by decrypting the traffic to Amazon. To allow that you'll need to get the certificate authority your proxy is using to build its TLS certificates and pass the path to that cert to |
OK thanks, is there a way to not have to have the user:pass in any script? |
Yes. Requests supports reading proxy data from the environment variables |
It still requires user : password to be in plaintext somewhere which I don't like. Do you where the machine certificate store would be located on windows? (I can make it work with verify false now.) |
The windows certificate store is in the registry. The |
using the example on the wincertstore site what would I pass to verify?
|
You'd need to iterate over the store and write out all of |
OK, one other thing, what is easier to implement requests-kerberos or requests-ntlm? I think our proxy supports either and want to try easiest first. |
I am honestly not sure. Might be worth trying either. 😄 |
I've made good progress now, appreciate the input. I hope quandl add the proxy and the verify to their implementation. |
Indeed, good luck! |
requests-kerberos gives a MutualAuthenticationError: Unable to authenticate <Response [302]> I think this is now related to issue 64 request-ntlm requires the user and password so doesn't add value. |
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
The initial request returns a status 302.
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
The text was updated successfully, but these errors were encountered: