Skip to content

Commit

Permalink
add proxy support
Browse files Browse the repository at this point in the history
  • Loading branch information
Siopy committed Mar 21, 2024
1 parent 41a359e commit 4b54020
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exegol/utils/WebUtils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import re
import time
import os
from typing import Any, Optional, Dict

import requests
Expand Down Expand Up @@ -124,7 +125,8 @@ def __runRequest(cls, url: str, service_name: str, headers: Optional[Dict] = Non
for i in range(retry_count):
try:
try:
response = requests.request(method=method, url=url, timeout=(5, 10), verify=ParametersManager().verify, headers=headers, data=data)
proxy = os.environ.get('HTTP_PROXY') or os.environ.get('HTTPS_PROXY')
response = requests.request(method=method, url=url, timeout=(5, 10), verify=ParametersManager().verify, headers=headers, data=data, proxies={'http': proxy, 'https': proxy} if proxy else None)
return response
except requests.exceptions.HTTPError as e:
if e.response is not None:
Expand Down

0 comments on commit 4b54020

Please sign in to comment.