Skip to content

Commit 02d2fdf

Browse files
committed
Handle webcam URI retrieval errors in connect_to_duet function
1 parent 380fd92 commit 02d2fdf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

meltingplot/duet_simplyprint_connector/cli/autodiscover.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ async def connect_to_duet(address: str, password: str) -> dict:
110110
board = board['result']
111111
duet_name = await duet.rr_model(key='network.name')
112112
duet_name = duet_name['result']
113-
webcam_uri = await get_webcam_url(duet)
113+
try:
114+
webcam_uri = await get_webcam_url(duet)
115+
except aiohttp.client_exceptions.ClientResponseError:
116+
webcam_uri = None
114117
try:
115118
cookie = await get_cookie(duet)
116119
except aiohttp.client_exceptions.ClientResponseError:
@@ -132,7 +135,7 @@ async def connect_to_duet(address: str, password: str) -> dict:
132135
'duet_uri': normalize_url(f'{address}'),
133136
'duet_password': password,
134137
'duet_unique_id': f"{board['uniqueId']}",
135-
'webcam_uri': normalize_url(webcam_uri),
138+
'webcam_uri': normalize_url(webcam_uri) if webcam_uri is not None else None,
136139
'cookie': cookie,
137140
}
138141

0 commit comments

Comments
 (0)