From b6127ca9ca7adf7f5a55c4fe6602afa5744707d0 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Thu, 13 Aug 2015 15:04:49 -0400 Subject: [PATCH] Ignore empty fields in no_proxy --- requests/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requests/utils.py b/requests/utils.py index 3fd0e41f..129134aa 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -499,7 +499,9 @@ def should_bypass_proxies(url): if no_proxy: # We need to check whether we match here. We need to see if we match # the end of the netloc, both with and without the port. - no_proxy = no_proxy.replace(' ', '').split(',') + no_proxy = ( + host for host in no_proxy.replace(' ', '').split(',') if host + ) ip = netloc.split(':')[0] if is_ipv4_address(ip):