Integrate httpx exceptions

This commit is contained in:
taizan-hokouto
2020-10-26 23:39:33 +09:00
parent 90596be880
commit 499cf26fa8
4 changed files with 5 additions and 7 deletions

View File

@@ -9,7 +9,6 @@ from ... import config
from ... paramgen import arcparam
from ... exceptions import UnknownConnectionError
from concurrent.futures import CancelledError
from httpx import NetworkError, TimeoutException, ConnectError
from json import JSONDecodeError
from urllib.parse import quote
@@ -81,7 +80,7 @@ def ready_blocks(video_id, duration, div, callback):
break
except JSONDecodeError:
await asyncio.sleep(3)
except (NetworkError, TimeoutException, ConnectError) as e:
except httpx.HTTPError as e:
err = e
await asyncio.sleep(3)
else:
@@ -137,7 +136,7 @@ def fetch_patch(callback, blocks, video_id):
break
except JSONDecodeError:
await asyncio.sleep(3)
except (NetworkError, TimeoutException, ConnectError) as e:
except httpx.HTTPError as e:
err = e
await asyncio.sleep(3)
except socket.error as error:

View File

@@ -2,7 +2,6 @@ import httpx
import json
import re
import time
from httpx import ConnectError, NetworkError, TimeoutException
from .. import config
from ..exceptions import InvalidVideoIdException, PatternUnmatchError, UnknownConnectionError
from ..util.extract_video_id import extract_video_id
@@ -107,7 +106,7 @@ class VideoInfo:
resp = httpx.get(url, headers=headers)
resp.raise_for_status()
break
except (ConnectError, NetworkError, TimeoutException) as e:
except httpx.HTTPError as e:
err = e
time.sleep(3)
else: