Project

General

Profile

0001-misc-add-a-REQUESTS_PROXIES-settings-for-requests-ca.patch

Thomas Noël, 30 November 2017 04:37 PM

Download (1.67 KB)

View differences:

Subject: [PATCH] misc: add a REQUESTS_PROXIES settings for requests calls
 (#20371)

 wcs/qommon/misc.py | 3 ++-
 wcs/settings.py    | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
wcs/qommon/misc.py
except ImportError:
Image = None
from django.conf import settings
from django.utils import datetime_safe
from quixote import get_publisher, get_response, get_request
......
try:
response = requests.request(method, url, headers=headers, data=body,
timeout=timeout, cert=cert_file)
timeout=timeout, cert=cert_file, proxies=settings.REQUESTS_PROXIES)
except requests.Timeout:
raise ConnectionError('connection timed out while fetching the page')
except requests.RequestException as err:
wcs/settings.py
WCS_LEGACY_CONFIG_FILE = None
# proxies=REQUESTS_PROXIES is used in python-requests call
# http://docs.python-requests.org/en/master/user/advanced/?highlight=proxy#proxies
REQUESTS_PROXIES = None
local_settings_file = os.environ.get('WCS_SETTINGS_FILE',
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
if os.path.exists(local_settings_file):