From: Mher Movsisyan Date: Sun, 27 May 2012 17:21:26 +0000 (+0500) Subject: no_proxy support X-Git-Tag: v0.13.0~8^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8561cda5e2bf9cb0129c2863ff52754e837ad85;p=services%2Fpython-requests.git no_proxy support --- diff --git a/requests/models.py b/requests/models.py index 79a3bc3..94e6e03 100644 --- a/requests/models.py +++ b/requests/models.py @@ -9,6 +9,7 @@ This module contains the primary objects that power Requests. import json import os +import string from datetime import datetime from .hooks import dispatch_hook, HOOKS @@ -521,9 +522,10 @@ class Request(object): self.headers['Content-Type'] = content_type _p = urlparse(url) + no_proxy = filter(string.strip, self.proxies.get('no', '').split(',')) proxy = self.proxies.get(_p.scheme) - if proxy: + if proxy and not any(map(_p.netloc.endswith, no_proxy)): conn = poolmanager.proxy_from_url(proxy) _proxy = urlparse(proxy) if '@' in _proxy.netloc: