Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
Use ssl context in aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Apr 19, 2020
1 parent 3e9c4be commit 46a75ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rhasspy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import platform
import shutil
import ssl
import tempfile
from collections import defaultdict
from pathlib import Path
Expand Down Expand Up @@ -86,6 +87,8 @@ def __init__(
self.defaults = Profile.load_defaults(system_profiles_dir)

self.loop = asyncio.get_event_loop()

self.ssl_context = ssl.SSLContext()
self._session: Optional[aiohttp.ClientSession] = aiohttp.ClientSession()
self.dialogue_manager: Optional[RhasspyActor] = None

Expand Down Expand Up @@ -523,7 +526,7 @@ async def download_file(url, filename):
self._logger.debug(status)
os.makedirs(os.path.dirname(filename), exist_ok=True)

async with self.session.get(url) as response:
async with self.session.get(url, ssl=ssl_context) as response:
with open(filename, "wb") as out_file:
async for chunk in response.content.iter_chunked(chunk_size):
out_file.write(chunk)
Expand Down

0 comments on commit 46a75ec

Please sign in to comment.