Skip to content

Commit cd5378c

Browse files
committed
fix mypy error with correct use of HTTPX status codes
1 parent 59ba191 commit cd5378c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

assemblyai/api.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def create_transcript(
4141
by_alias=True,
4242
),
4343
)
44-
if response.status_code != httpx.codes.ok:
44+
if response.status_code != httpx.codes.OK:
4545
raise types.TranscriptError(
4646
f"failed to transcribe url {request.audio_url}: {_get_error_message(response)}"
4747
)
@@ -57,7 +57,7 @@ def get_transcript(
5757
f"{ENDPOINT_TRANSCRIPT}/{transcript_id}",
5858
)
5959

60-
if response.status_code != httpx.codes.ok:
60+
if response.status_code != httpx.codes.OK:
6161
raise types.TranscriptError(
6262
f"failed to retrieve transcript {transcript_id}: {_get_error_message(response)}",
6363
)
@@ -73,7 +73,7 @@ def delete_transcript(
7373
f"{ENDPOINT_TRANSCRIPT}/{transcript_id}",
7474
)
7575

76-
if response.status_code != httpx.codes.ok:
76+
if response.status_code != httpx.codes.OK:
7777
raise types.TranscriptError(
7878
f"failed to delete transcript {transcript_id}: {_get_error_message(response)}",
7979
)
@@ -100,7 +100,7 @@ def upload_file(
100100
content=audio_file,
101101
)
102102

103-
if response.status_code != httpx.codes.ok:
103+
if response.status_code != httpx.codes.OK:
104104
raise types.TranscriptError(
105105
f"Failed to upload audio file: {_get_error_message(response)}"
106106
)
@@ -125,7 +125,7 @@ def export_subtitles_srt(
125125
params=params,
126126
)
127127

128-
if response.status_code != httpx.codes.ok:
128+
if response.status_code != httpx.codes.OK:
129129
raise types.TranscriptError(
130130
f"failed to export SRT for transcript {transcript_id}: {_get_error_message(response)}"
131131
)
@@ -150,7 +150,7 @@ def export_subtitles_vtt(
150150
params=params,
151151
)
152152

153-
if response.status_code != httpx.codes.ok:
153+
if response.status_code != httpx.codes.OK:
154154
raise types.TranscriptError(
155155
f"failed to export VTT for transcript {transcript_id}: {_get_error_message(response)}"
156156
)
@@ -172,7 +172,7 @@ def word_search(
172172
),
173173
)
174174

175-
if response.status_code != httpx.codes.ok:
175+
if response.status_code != httpx.codes.OK:
176176
raise types.TranscriptError(
177177
f"failed to search words in transcript {transcript_id}: {_get_error_message(response)}"
178178
)
@@ -223,7 +223,7 @@ def get_sentences(
223223
f"{ENDPOINT_TRANSCRIPT}/{transcript_id}/sentences",
224224
)
225225

226-
if response.status_code != httpx.codes.ok:
226+
if response.status_code != httpx.codes.OK:
227227
raise types.TranscriptError(
228228
f"failed to retrieve sentences for transcript {transcript_id}: {_get_error_message(response)}"
229229
)
@@ -239,7 +239,7 @@ def get_paragraphs(
239239
f"{ENDPOINT_TRANSCRIPT}/{transcript_id}/paragraphs",
240240
)
241241

242-
if response.status_code != httpx.codes.ok:
242+
if response.status_code != httpx.codes.OK:
243243
raise types.TranscriptError(
244244
f"failed to retrieve paragraphs for transcript {transcript_id}: {_get_error_message(response)}"
245245
)
@@ -262,7 +262,7 @@ def list_transcripts(
262262
),
263263
)
264264

265-
if response.status_code != httpx.codes.ok:
265+
if response.status_code != httpx.codes.OK:
266266
raise types.AssemblyAIError(
267267
f"failed to retrieve transcripts: {_get_error_message(response)}"
268268
)
@@ -283,7 +283,7 @@ def lemur_question(
283283
timeout=http_timeout,
284284
)
285285

286-
if response.status_code != httpx.codes.ok:
286+
if response.status_code != httpx.codes.OK:
287287
raise types.LemurError(
288288
f"failed to call Lemur questions: {_get_error_message(response)}"
289289
)
@@ -304,7 +304,7 @@ def lemur_summarize(
304304
timeout=http_timeout,
305305
)
306306

307-
if response.status_code != httpx.codes.ok:
307+
if response.status_code != httpx.codes.OK:
308308
raise types.LemurError(
309309
f"failed to call Lemur summary: {_get_error_message(response)}"
310310
)
@@ -325,7 +325,7 @@ def lemur_action_items(
325325
timeout=http_timeout,
326326
)
327327

328-
if response.status_code != httpx.codes.ok:
328+
if response.status_code != httpx.codes.OK:
329329
raise types.LemurError(
330330
f"failed to call Lemur action items: {_get_error_message(response)}"
331331
)
@@ -346,7 +346,7 @@ def lemur_task(
346346
timeout=http_timeout,
347347
)
348348

349-
if response.status_code != httpx.codes.ok:
349+
if response.status_code != httpx.codes.OK:
350350
raise types.LemurError(
351351
f"failed to call Lemur task: {_get_error_message(response)}"
352352
)
@@ -364,7 +364,7 @@ def lemur_purge_request_data(
364364
timeout=http_timeout,
365365
)
366366

367-
if response.status_code != httpx.codes.ok:
367+
if response.status_code != httpx.codes.OK:
368368
raise types.LemurError(
369369
f"Failed to purge LeMUR request data for provided request ID: {request.request_id}. Error: {_get_error_message(response)}"
370370
)
@@ -385,7 +385,7 @@ def lemur_get_response_data(
385385
timeout=http_timeout,
386386
)
387387

388-
if response.status_code != httpx.codes.ok:
388+
if response.status_code != httpx.codes.OK:
389389
raise types.LemurError(
390390
f"Failed to get LeMUR response data for provided request ID: {request_id}. Error: {_get_error_message(response)}"
391391
)
@@ -409,7 +409,7 @@ def create_temporary_token(
409409
timeout=http_timeout,
410410
)
411411

412-
if response.status_code != httpx.codes.ok:
412+
if response.status_code != httpx.codes.OK:
413413
raise types.AssemblyAIError(
414414
f"Failed to create temporary token: {_get_error_message(response)}"
415415
)

0 commit comments

Comments
 (0)