-
Notifications
You must be signed in to change notification settings - Fork 223
Add allow self signed to edge simulator #3814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
ce2da9b
4c2de44
9dc364e
7071ef2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
|
|
||
|
|
||
| class FegApi: | ||
| def __init__(self, endpoint: str, device_info: DeviceInfo, user_info: UserInfo): | ||
| def __init__(self, endpoint: str, device_info: DeviceInfo, user_info: UserInfo, allow_self_signed: bool = False): | ||
| self.endpoint = endpoint | ||
| self.device_info = device_info | ||
| self.user_info = user_info | ||
|
|
@@ -46,6 +46,7 @@ def __init__(self, endpoint: str, device_info: DeviceInfo, user_info: UserInfo): | |
| HttpHeaderKey.DEVICE_INFO: device_qs, | ||
| HttpHeaderKey.USER_INFO: user_qs, | ||
| } | ||
| self.allow_self_signed = allow_self_signed | ||
|
|
||
| def get_job(self, request: JobRequest) -> JobResponse: | ||
| return self._do_post( | ||
|
|
@@ -91,7 +92,9 @@ def get_selection(self, request: SelectionRequest) -> SelectionResponse: | |
| ) | ||
|
|
||
| def _do_post(self, clazz, url, params, body): | ||
| response = requests.post(url, params=params, json=body, headers=self.common_headers) | ||
| response = requests.post( | ||
| url, params=params, json=body, headers=self.common_headers, verify=False if self.allow_self_signed else True | ||
| ) | ||
|
Comment on lines
98
to
100
|
||
| code = response.status_code | ||
| if code == 200: | ||
| return clazz(**response.json()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
allow_self_signedconfiguration value is not validated to ensure it's a boolean type. If a user provides a non-boolean value (e.g., a string like "true" or an integer like 1), it could lead to unexpected behavior. Add type validation usingcheck_object_type(\"allow_self_signed\", n, bool)after retrieving the value, similar to how other configuration values are validated in this method.