Skip to content

Commit d56fb02

Browse files
committed
chore: supports 404 in check_write
1 parent 5bbe48b commit d56fb02

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/connection_check.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ def check_write():
4242
try:
4343
client.write_api(write_options=SYNCHRONOUS).write(bucket, org, b"")
4444
except ApiException as e:
45-
# missing credentials
45+
# bucket does not exist
4646
if e.status == 404:
47-
raise Exception(f"The specified token doesn't have sufficient credentials to write to '{bucket}' "
48-
f"or specified bucket doesn't exists.") from e
47+
raise Exception(f"The specified bucket does not exist.") from e
48+
# insufficient permissions
49+
if e.status == 403:
50+
raise Exception(f"The specified token does not have sufficient credentials to write to '{bucket}'.") from e
4951
# 400 (BadRequest) caused by empty LineProtocol
5052
if e.status != 400:
5153
raise

0 commit comments

Comments
 (0)