Support CIDR notation in 'NO_PROXY'

I would like to add support for CIDR notation in the NO_PROXY environment to Python (=urllib)

I happen to maintain a large playbook in Ansible, which rely on python, and usually can’t use anything else than stdlib for its module, so can’t support CIDR in no_proxy.
(Ansible issue in question)

I expect the benefits would be larger than just the ansible ecosystem, though. This would basically be the Python part of this Gitlab blog

I started the implementation if anyone wants a look.

I noticed there is another issue open in cpython/python which I would tackle at the same time regarding supporting ‘’ in domains (aka = '.my.domain.com’ == ‘.mydomain.com’ in NO_PROXY):

Wdyt ?