classification
Title: Windows proxy settings automatically used ... partly
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: SilentGhost, iwetzel, orsenthil, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-05-15 20:59 by iwetzel, last changed 2019-05-16 16:56 by iwetzel. This issue is now closed.

Messages (9)
msg342601 - (view) Author: Immo Wetzel (iwetzel) Date: 2019-05-15 20:59
I do run python 2.7/3.7 on a windows 7 host.
This host is AD managed. As part of the group policy the internet settings are set to automatically proxy configuration.
The configuration works. cos IE and Chrome can reach external and internal hosts. Some of the internal are excluded from proxy via no proxy rules inside the pac file.

But python request and urllib2 are not able to reach the internal addresses which are excluded via the proxy file rules. Python always tries to get the data from the proxy.

the only solution was an extra environmental variable NO_PROXY with the ips not to be reached via the proxy.

these excluded IPs are common IPs and not private ! (90.0.0.0/8) is part of the pac exclusion
msg342607 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-05-15 22:24
As far as I can see, this issue has nothing to do with IDLE as such.

Someone else should decide if this is a bug report or an enhancement request.
msg342629 - (view) Author: Immo Wetzel (iwetzel) Date: 2019-05-16 08:37
ok where should I place this . IO or Library ?

If this is not a bug .... I really have to do some soul-searching
msg342630 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-05-16 08:44
Immo, please be careful when editing the fields. You've set the values that were explicitly removed by the developer. Library is fine.
msg342656 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-16 15:58
Can you clarify how you are setting your proxy configuration and how Python is finding out about it?

Also, which libraries are you using?

As far as I'm aware, Python itself does nothing special to load proxy settings from normal Windows configuration. Doing so would be a feature request (though it's one I'd like to see happen).
msg342657 - (view) Author: Immo Wetzel (iwetzel) Date: 2019-05-16 16:09
>Can you clarify how you are setting your proxy configuration and how >Python is finding out about it?
The windows host get his proxy configuration via group police from the Active Directory. The group policy points to a specific file wpad.dat formerly known as proxy.pac
This is a configuration used for IE and Chrome automatically from the hosts.

How Python finds this out and is using this is unclear to me. There is definitely no environment variable setting done.

>Also, which libraries are you using?
request and urllib2 both are failing

>As far as I'm aware, Python itself does nothing special to load proxy settings from normal Windows configuration. Doing so would be a feature request (though it's one I'd like to see happen).

I was guessing so too. Especially cos all help site tell me how to specify proxy objects for use with requests lib. But obviously there is something existing.
msg342658 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-16 16:13
requests is a third-party library, so if they're finding your settings you probably need to report it to them.

urllib2 is only part of Python 2.x. Do you have a repro with urllib on Python 3?
msg342660 - (view) Author: Immo Wetzel (iwetzel) Date: 2019-05-16 16:35
thanks for pointing this out. I've retested urllib3 with success. requests with no success. so I'll write a new issue on requests. Thanks a lot
msg342663 - (view) Author: Immo Wetzel (iwetzel) Date: 2019-05-16 16:56
issue is only on urllib2 and requests (external lib)
ticket opened: https://github.com/kennethreitz/requests/issues/5095
History
Date User Action Args
2019-05-16 16:56:10iwetzelsetstatus: open -> closed

messages: + msg342663
stage: test needed -> resolved
2019-05-16 16:35:06iwetzelsetmessages: + msg342660
2019-05-16 16:13:36steve.dowersetmessages: + msg342658
2019-05-16 16:09:13iwetzelsetmessages: + msg342657
2019-05-16 15:58:59steve.dowersetmessages: + msg342656
2019-05-16 08:44:18SilentGhostsetversions: + Python 3.8
2019-05-16 08:44:02SilentGhostsetassignee: terry.reedy ->
type: behavior
components: - IDLE, IO
versions: - Python 3.6
nosy: + SilentGhost, orsenthil, - terry.reedy

messages: + msg342630
2019-05-16 08:37:45iwetzelsetversions: + Python 3.6, - Python 3.8
nosy: + terry.reedy

messages: + msg342629

assignee: terry.reedy
components: + IDLE
2019-05-15 22:24:44terry.reedysetnosy: - terry.reedy
2019-05-15 22:24:05terry.reedysetversions: + Python 3.8, - Python 3.6
nosy: terry.reedy, paul.moore, tim.golden, zach.ware, steve.dower, iwetzel
messages: + msg342607

assignee: terry.reedy -> (no value)
components: - IDLE
stage: test needed
2019-05-15 20:59:59iwetzelcreate