Skip to content

Commit

Permalink
fix: 403 http error consulcam website (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
billmetangmo committed Jul 11, 2023
1 parent 546108e commit 929bc5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion infra/api/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
4 changes: 4 additions & 0 deletions infra/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ variable "TFC_WORKSPACE_NAME" {
type = string
default = ""
}

variable "PROXY_URL" {
type = string
}

0 comments on commit 929bc5f

Please sign in to comment.