File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 33
33
logging .basicConfig (level = logging .INFO )
34
34
logging .getLogger ("zeep.client" ).setLevel (logging .CRITICAL )
35
35
36
-
36
+ _SENTINEL = object ()
37
37
_WSDL_PATH = os .path .join (os .path .dirname (os .path .dirname (__file__ )), "wsdl" )
38
38
_DEFAULT_TIMEOUT = 90
39
39
_PULLPOINT_TIMEOUT = 90
@@ -501,13 +501,19 @@ async def close(self) -> None:
501
501
502
502
async def get_snapshot_uri (self , profile_token : str ) -> str :
503
503
"""Get the snapshot uri for a given profile."""
504
- uri = self ._snapshot_uris .get (profile_token )
505
- if uri is None :
504
+ uri = self ._snapshot_uris .get (profile_token , _SENTINEL )
505
+ if uri is _SENTINEL :
506
506
media_service = await self .create_media_service ()
507
507
req = media_service .create_type ("GetSnapshotUri" )
508
508
req .ProfileToken = profile_token
509
509
result = await media_service .GetSnapshotUri (req )
510
- uri = normalize_url (result .Uri )
510
+ try :
511
+ uri = normalize_url (result .Uri )
512
+ except KeyError :
513
+ logger .warning (
514
+ "%s: The device returned an invalid snapshot URI" , self .host
515
+ )
516
+ uri = None
511
517
self ._snapshot_uris [profile_token ] = uri
512
518
return uri
513
519
You can’t perform that action at this time.
0 commit comments