2
2
3
3
from __future__ import annotations
4
4
5
- from abc import abstractmethod
6
5
import asyncio
7
6
import datetime as dt
8
7
import logging
9
- from typing import TYPE_CHECKING , Any
8
+ from abc import abstractmethod
10
9
from collections .abc import Callable
10
+ from typing import TYPE_CHECKING , Any
11
11
12
- import httpx
13
- from httpx import TransportError
14
12
from zeep .exceptions import Fault , XMLParseError , XMLSyntaxError
15
13
from zeep .loader import parse_xml
16
14
from zeep .wsdl .bindings .soap import SoapOperation
17
15
16
+ import aiohttp
18
17
from onvif .exceptions import ONVIFError
19
18
20
19
from .settings import DEFAULT_SETTINGS
27
26
28
27
_RENEWAL_PERCENTAGE = 0.8
29
28
30
- SUBSCRIPTION_ERRORS = (Fault , asyncio .TimeoutError , TransportError )
31
- RENEW_ERRORS = (ONVIFError , httpx . RequestError , XMLParseError , * SUBSCRIPTION_ERRORS )
29
+ SUBSCRIPTION_ERRORS = (Fault , asyncio .TimeoutError , aiohttp . ClientError )
30
+ RENEW_ERRORS = (ONVIFError , aiohttp . ClientError , XMLParseError , * SUBSCRIPTION_ERRORS )
32
31
SUBSCRIPTION_RESTART_INTERVAL_ON_ERROR = dt .timedelta (seconds = 40 )
33
32
34
33
# If the camera returns a subscription with a termination time that is less than
@@ -87,7 +86,8 @@ async def stop(self) -> None:
87
86
await self ._subscription .Unsubscribe ()
88
87
89
88
async def shutdown (self ) -> None :
90
- """Shutdown the manager.
89
+ """
90
+ Shutdown the manager.
91
91
92
92
This method is irreversible.
93
93
"""
@@ -105,7 +105,7 @@ async def set_synchronization_point(self) -> float:
105
105
"""Set the synchronization point."""
106
106
try :
107
107
await self ._service .SetSynchronizationPoint ()
108
- except (Fault , asyncio . TimeoutError , TransportError , TypeError ):
108
+ except (TimeoutError , Fault , aiohttp . ClientError , TypeError ):
109
109
logger .debug ("%s: SetSynchronizationPoint failed" , self ._service .url )
110
110
111
111
def _cancel_renewals (self ) -> None :
@@ -214,7 +214,8 @@ def __init__(
214
214
super ().__init__ (device , interval , subscription_lost_callback )
215
215
216
216
async def _start (self ) -> float :
217
- """Start the notification processor.
217
+ """
218
+ Start the notification processor.
218
219
219
220
Returns the next renewal call at time.
220
221
"""
@@ -290,7 +291,8 @@ class PullPointManager(BaseManager):
290
291
"""Manager for PullPoint."""
291
292
292
293
async def _start (self ) -> float :
293
- """Start the PullPoint manager.
294
+ """
295
+ Start the PullPoint manager.
294
296
295
297
Returns the next renewal call at time.
296
298
"""
0 commit comments