Skip to content

Commit 75ff078

Browse files
Add NUCLEUS_SKIP_SSL_VERIFY for different environments (#431)
--------- Co-authored-by: Sam Videlock <sam.videlock@scalegov.com>
1 parent 05435fc commit 75ff078

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Fixes
1515
- Fix test `test_models.test_remove_invalid_tag_from_model`
1616

17+
## [0.17.1] - 2024-02-22
18+
19+
### Added
20+
- Environment variable `NUCLEUS_SKIP_SSL_VERIFY` to skip SSL verification on requests
1721

1822
## [0.16.18](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.16.18) - 2024-02-06
1923

nucleus/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import time
23
from typing import Optional
34

@@ -68,6 +69,7 @@ def make_request(
6869
headers={"Content-Type": "application/json"},
6970
auth=(self.api_key, ""),
7071
timeout=DEFAULT_NETWORK_TIMEOUT_SEC,
72+
verify=os.environ.get("NUCLEUS_SKIP_SSL_VERIFY", None) is None,
7173
)
7274
logger.info(
7375
"API request has response code %s", response.status_code

nucleus/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,11 @@ def serialize_and_write(
361361

362362
def upload_to_presigned_url(presigned_url: str, file_pointer: IO):
363363
# TODO optimize this further to deal with truly huge files and flaky internet connection.
364-
upload_response = requests.put(presigned_url, file_pointer)
364+
upload_response = requests.put(
365+
presigned_url,
366+
file_pointer,
367+
verify=os.environ.get("NUCLEUS_SKIP_SSL_VERIFY", None) is None,
368+
)
365369
if not upload_response.ok:
366370
raise HTTPError( # type: ignore
367371
f"Tried to put a file to url, but failed with status {upload_response.status_code}. The detailed error was: {upload_response.text}"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ignore = ["E501", "E741", "E731", "F401"] # Easy ignore for getting it running
2525

2626
[tool.poetry]
2727
name = "scale-nucleus"
28-
version = "0.17.0"
28+
version = "0.17.1"
2929
description = "The official Python client library for Nucleus, the Data Platform for AI"
3030
license = "MIT"
3131
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]

0 commit comments

Comments
 (0)