Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages = [
{include = "**/*.py", from = "src"},
]
readme = "README.md"
version = "0.14.0"
version = "0.14.1"

[tool.poetry.dependencies]
# For certifi, use ">=" instead of "^" since it upgrades its "major version" every year, not really following semver
Expand Down
7 changes: 4 additions & 3 deletions src/groundlight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Set urllib3 request timeout to something modern and fast.
# The system defaults can be stupidly long
# It used to take >8 min to timeout to a bad IP address
DEFAULT_REQUEST_TIMEOUT = 5
DEFAULT_REQUEST_TIMEOUT = 10 # seconds


class GroundlightClientError(Exception):
Expand Down Expand Up @@ -427,14 +427,15 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t

image_bytesio: ByteStreamWrapper = parse_supported_image_types(image)

params = {"detector_id": detector_id, "body": image_bytesio}
params = {"detector_id": detector_id, "body": image_bytesio, "_request_timeout": DEFAULT_REQUEST_TIMEOUT}

if patience_time is not None:
params["patience_time"] = patience_time

if human_review is not None:
params["human_review"] = human_review

if inspection_id is not None:
if inspection_id: # consider an empty string to mean there is no inspection
params["inspection_id"] = inspection_id

if want_async is True:
Expand Down
12 changes: 12 additions & 0 deletions test/integration/test_groundlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,3 +796,15 @@ def test_submit_image_query_with_inspection_id_metadata_and_want_async(gl: Groun

assert iq.metadata == metadata
assert iq.result.label == Label.YES


def test_submit_image_query_with_empty_inspection_id(gl: Groundlight, detector: Detector, image: str):
"""The URCap submits the inspection_id as an empty string when there is no active inspection.
This test ensures that this behavior is allowed and does not raise an exception.
"""
gl.submit_image_query(
detector=detector.id,
image=image,
human_review="NEVER",
inspection_id="",
)