Skip to content

Commit 881a66a

Browse files
Parthibwhoseoyster
authored andcommitted
OPEN-3938: New VERIFY_REQUESTS parameter gives control over custom SSL certificate path
1 parent e3c4579 commit 881a66a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616

1717
* Added `protobuf<3.20` to requirements to fix compatibility issue with Tensorflow.
1818
* Warnings if the dependencies from the `requirement_txt_file` and current environment are inconsistent.
19+
* Paths to custom SSL certificates can now be modified by altering `openlayer.api.VERIFY_REQUESTS`. The value can either be True (default), False, or a path to a certificate.
1920

2021
### Changed
2122

openlayer/api.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class StorageType(Enum):
3131

3232
STORAGE = StorageType.AWS
3333
OPENLAYER_ENDPOINT = "https://api.openlayer.com/v1"
34+
# Controls the `verify` parameter on requests in case a custom
35+
# certificate is needed or needs to be disabled altogether
36+
VERIFY_REQUESTS = True
3437

3538

3639
class Api:
@@ -201,7 +204,7 @@ def upload_blob_s3(
201204
e, lambda monitor: t.update(min(t.total, monitor.bytes_read) - t.n)
202205
)
203206
headers = {"Content-Type": m.content_type}
204-
res = requests.post(presigned_json["url"], data=m, headers=headers)
207+
res = requests.post(presigned_json["url"], data=m, headers=headers, verify=VERIFY_REQUESTS)
205208

206209
if res.ok:
207210
body["storageUri"] = presigned_json["storageUri"]
@@ -229,6 +232,7 @@ def upload_blob_gcs(
229232
presigned_json["url"],
230233
data=wrapped_file,
231234
headers={"Content-Type": "application/x-gzip"},
235+
verify=VERIFY_REQUESTS
232236
)
233237
if res.ok:
234238
body["storageUri"] = presigned_json["storageUri"]
@@ -259,6 +263,7 @@ def upload_blob_azure(
259263
"Content-Type": "application/x-gzip",
260264
"x-ms-blob-type": "BlockBlob",
261265
},
266+
verify=VERIFY_REQUESTS
262267
)
263268
if res.ok:
264269
body["storageUri"] = presigned_json["storageUri"]

openlayer/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Define the SDK version here so that the interal package can have access to this value.
22
# See https://stackoverflow.com/questions/2058802
3-
__version__ = "0.0.0a11"
3+
__version__ = "0.0.0a12"

0 commit comments

Comments
 (0)