From 81e8306dcfc44e33e5ab33416dcf00185ca9eb29 Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Sun, 8 Dec 2024 20:27:52 +0100 Subject: [PATCH] fix: add support for HTTP proxy --- custom_components/cz_energy_spot_prices/cnb_rate.py | 2 +- custom_components/cz_energy_spot_prices/spot_rate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/cz_energy_spot_prices/cnb_rate.py b/custom_components/cz_energy_spot_prices/cnb_rate.py index 37a74c3..7cdf11f 100644 --- a/custom_components/cz_energy_spot_prices/cnb_rate.py +++ b/custom_components/cz_energy_spot_prices/cnb_rate.py @@ -18,7 +18,7 @@ async def download_rates(self, day: date) -> str: 'date': day.strftime('%d.%m.%Y') } - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: async with session.get(self.RATES_URL, params=params) as response: text = await response.text() return text diff --git a/custom_components/cz_energy_spot_prices/spot_rate.py b/custom_components/cz_energy_spot_prices/spot_rate.py index fcdeec5..15bb148 100644 --- a/custom_components/cz_energy_spot_prices/spot_rate.py +++ b/custom_components/cz_energy_spot_prices/spot_rate.py @@ -90,7 +90,7 @@ def get_gas_query(self, start: date, end: date) -> str: async def _download(self, query: str) -> str: try: - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: async with session.post(self.OTE_PUBLIC_URL, data=query) as response: return await response.text() except aiohttp.ClientError as e: