-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
If the API key is set to the empty string we get the following error when attempting gl=Groundlight():
sunilkumar@raspberrypi:~/Documents/gl_on_pi $ export GROUNDLIGHT_API_TOKEN=
sunilkumar@raspberrypi:~/Documents/gl_on_pi $ python3 main.py
Traceback (most recent call last):
File "/home/sunilkumar/Documents/gl_on_pi/main.py", line 20, in <module>
is_locked = is_door_locked(image=image)
File "/home/sunilkumar/Documents/gl_on_pi/logic.py", line 18, in is_door_locked
detector = gl.get_or_create_detector(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 106, in get_or_create_detector
existing_detector = self.get_detector_by_name(name)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 85, in get_detector_by_name
detector_list = self.list_detectors(page_size=250)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 95, in list_detectors
obj = self.detectors_api.list_detectors(page=page, page_size=page_size)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api/detectors_api.py", line 333, in list_detectors
return self.list_detectors_endpoint.call_with_http_info(**kwargs)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 840, in call_with_http_info
return self.api_client.call_api(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/internalapi.py", line 79, in call_api
return super().call_api(*args, **kwargs)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 391, in call_api
return self.__call_api(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 186, in __call_api
response_data = self.request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 445, in request
return self.rest_client.GET(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/rest.py", line 247, in GET
return self.request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/rest.py", line 216, in request
r = self.pool_manager.request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/request.py", line 74, in request
return self.request_encode_url(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/request.py", line 96, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/poolmanager.py", line 376, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/connection.py", line 244, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.9/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1296, in _send_request
self.putheader(hdr, value)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/urllib3/connection.py", line 224, in putheader
_HTTPConnection.putheader(self, header, *values)
File "/usr/lib/python3.9/http/client.py", line 1232, in putheader
if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object
If the API key is set improperly we get:
sunilkumar@raspberrypi:~/Documents/gl_on_pi $ python3 main.py
Traceback (most recent call last):
File "/home/sunilkumar/Documents/gl_on_pi/main.py", line 20, in <module>
is_locked = is_door_locked(image=image)
File "/home/sunilkumar/Documents/gl_on_pi/logic.py", line 18, in is_door_locked
detector = gl.get_or_create_detector(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 106, in get_or_create_detector
existing_detector = self.get_detector_by_name(name)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 85, in get_detector_by_name
detector_list = self.list_detectors(page_size=250)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/client.py", line 95, in list_detectors
obj = self.detectors_api.list_detectors(page=page, page_size=page_size)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api/detectors_api.py", line 333, in list_detectors
return self.list_detectors_endpoint.call_with_http_info(**kwargs)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 840, in call_with_http_info
return self.api_client.call_api(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/groundlight/internalapi.py", line 79, in call_api
return super().call_api(*args, **kwargs)
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 391, in call_api
return self.__call_api(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 198, in __call_api
raise e
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 186, in __call_api
response_data = self.request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/api_client.py", line 445, in request
return self.rest_client.GET(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/rest.py", line 247, in GET
return self.request(
File "/home/sunilkumar/.local/lib/python3.9/site-packages/openapi_client/rest.py", line 231, in request
raise UnauthorizedException(http_resp=r)
openapi_client.exceptions.UnauthorizedException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 14 Apr 2023 00:52:28 GMT', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '18', 'Connection': 'keep-alive', 'Server': 'nginx/1.21.1', 'Vary': 'Origin, Cookie', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin', 'X-Request-Id-Resolved': 'req_uu0cbb218c2f824bf083e60dd91da5347f'})
HTTP response body: Not authenticated.
Metadata
Metadata
Assignees
Labels
No labels