Skip to content

Commit 3c589ee

Browse files
committed
Actually use proxies whenever they are defined
1 parent 83f7a25 commit 3c589ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Setup Quart, used for serving the web pages
4040
app = Quart(__name__)
41-
proxy = {}
41+
proxies = dict()
4242

4343
def example():
4444
return f"""Example
@@ -200,7 +200,7 @@ async def serve_feed(username, password, podcast_id):
200200
return Response("Invalid locale", 400, {})
201201

202202
with cloudscraper.create_scraper() as scraper:
203-
scraper.proxies = proxy
203+
scraper.proxies = proxies
204204
client = await check_auth(username, password, region, locale, scraper)
205205
if not client:
206206
return authenticate()
@@ -335,8 +335,9 @@ async def spawn_web_server():
335335

336336
async def main():
337337
if getenv("HTTP_PROXY"):
338+
global proxies
338339
print(f"Running with https proxy defined in environmental variable HTTP_PROXY: {getenv('HTTP_PROXY')}")
339-
proxy = { 'http': getenv("HTTP_PROXY") }
340+
proxies['https'] = getenv("HTTP_PROXY")
340341
tasks = [spawn_web_server()]
341342
await asyncio.gather(*tasks)
342343

0 commit comments

Comments
 (0)