no_proxy support

This commit is contained in:
Mher Movsisyan
2012-05-27 22:21:26 +05:00
parent de1637c3de
commit b8561cda5e
+3 -1
View File
@@ -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: