Skip to content

Commit

Permalink
fix(outlook): Попытка исправить ошибку «Asyncio Event Loop is Closed»
Browse files Browse the repository at this point in the history
Спорадическая ошибка.
Не уверен, что лечение помогает, но попробовать нужно.
Инструкция здесь:
encode/httpx#914 (comment)
  • Loading branch information
gmaFFFFF committed Mar 7, 2024
1 parent 002f979 commit 0604f7c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions outlook/downloader.py
@@ -1,5 +1,6 @@
import asyncio
import re
import sys
import unicodedata
from pathlib import Path

Expand All @@ -8,6 +9,10 @@
from httpx import Timeout, ReadTimeout, HTTPStatusError
from tenacity import AsyncRetrying, stop_after_attempt, wait_exponential, retry_if_exception_type

# Решение проблемы с вылетом с ошибкой Asyncio Event Loop is Closed
# https://github.com/encode/httpx/issues/914#issuecomment-622586610
if sys.version_info[0] == 3 and sys.version_info[1] >= 8 and sys.platform.startswith('win'):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

def slugify(value, allow_unicode=True):
"""
Expand Down

0 comments on commit 0604f7c

Please sign in to comment.