fix: proxy add to session correctly

pull/12/head
Cullen Watson 2023-09-19 16:05:14 -05:00
parent cdf41fe9f2
commit 0dae14ccfc
1 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,14 @@ class Scraper:
self.location = scraper_input.location self.location = scraper_input.location
self.listing_type = scraper_input.listing_type self.listing_type = scraper_input.listing_type
self.session = requests.Session(proxies=scraper_input.proxy) self.session = requests.Session()
if scraper_input.proxy:
proxy_url = scraper_input.proxy
proxies = {
"http": proxy_url,
"https": proxy_url
}
self.session.proxies.update(proxies)
self.listing_type = scraper_input.listing_type self.listing_type = scraper_input.listing_type
self.site_name = scraper_input.site_name self.site_name = scraper_input.site_name