Skip to content

Commit

Permalink
Make the list of proxies available in renpy.fetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
renpytom committed Mar 9, 2024
1 parent 6b5c555 commit 3d6c00d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion renpy/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4702,6 +4702,17 @@ def confirm(message):
return renpy.ui.interact()


try:
if PY2:
import urllib
proxies = urllib.getproxies()
else:
import urllib.request
proxies = urllib.request.getproxies()
except Exception as e:
proxies = {}


class FetchError(Exception):
"""
:undocumented:
Expand Down Expand Up @@ -4750,7 +4761,7 @@ def fetch_requests(url, method, data, content_type, timeout):

def make_request():
try:
r = requests.request(method, url, data=data, timeout=timeout, headers={ "Content-Type" : content_type } if data is not None else {})
r = requests.request(method, url, data=data, timeout=timeout, headers={ "Content-Type" : content_type } if data is not None else {}, proxies=proxies)
r.raise_for_status()
resp[0] = r.content # type: ignore
except Exception as e:
Expand Down

0 comments on commit 3d6c00d

Please sign in to comment.