diff --git a/infra/api/scan.py b/infra/api/scan.py index f3ca8be..2760652 100644 --- a/infra/api/scan.py +++ b/infra/api/scan.py @@ -48,7 +48,10 @@ def get_source_code(link): :param link: the link of the web page you want to scrape :return: the source code of the web page """ - r = requests.get(link) + proxy_url = os.environ["PROXY_URL"] + proxies = {"http": proxy_url, "https": proxy_url} + + r = requests.get(link,proxies=proxies, verify=False) r.raise_for_status() return soup(r.text) diff --git a/infra/main.tf b/infra/main.tf index f15a27b..0f62771 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -184,7 +184,7 @@ resource "aws_lambda_function" "scan" { API_KEY = var.API_KEY SENTRY_DNS = var.SENTRY_DNS ENV = (terraform.workspace == "mtchoun-mouh-master") ? "production" : "${terraform.workspace}" - + PROXY_URL = var.PROXY_URL } } diff --git a/infra/vars.tf b/infra/vars.tf index d851d46..8e20124 100644 --- a/infra/vars.tf +++ b/infra/vars.tf @@ -59,3 +59,7 @@ variable "TFC_WORKSPACE_NAME" { type = string default = "" } + +variable "PROXY_URL" { + type = string +}