From 924d3dabb93a5eba149b267f816223a65c02b319 Mon Sep 17 00:00:00 2001 From: Pierre Geeraert Date: Wed, 3 Dec 2025 12:41:50 +0000 Subject: [PATCH] add proxy on requests module --- django_code/stash_management/apps.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django_code/stash_management/apps.py b/django_code/stash_management/apps.py index b0dc472..ffbaf9c 100644 --- a/django_code/stash_management/apps.py +++ b/django_code/stash_management/apps.py @@ -28,6 +28,11 @@ proxy = urlrequest.ProxyHandler({ 'https': proxy_url # Add the handler for HTTPS }) +proxies = { + "http" : proxy_url, + "https" : proxy_url + } + destination_folder = "/tmp/stash" def hello(request): @@ -55,7 +60,8 @@ def album_downloader(name,url,external_galleries): req = urlrequest.Request(url) urlcurl = urlrequest.urlopen(req).read() - page = requests.get(url) + + page = requests.get(url,proxies=proxies) webpage = html.fromstring(page.content) #get all URLs from the code source (searching for href tag on the code)