Skip to content

Commit 4139951

Browse files
authored
Add S3_ENDPOINT to customize S3 endpoint URL (#432)
1 parent db9d5f2 commit 4139951

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.17.3] - 2024-02-29
9+
10+
### Added
11+
- Added the environment variable `S3_ENDPOINT` to accomodate for nonstandard S3 Endpoint URLs when asking for presigned URLs
12+
813
## [0.17.2](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.17.2) - 2024-02-28
914

1015
### Modified
1116
- In `Dataset.create_slice`, the `reference_ids` parameter is now optional. If left unspecified, it will create an empty slice
1217

13-
1418
## [0.17.1](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.17.1) - 2024-02-22
1519

1620
### Added
1721
- Environment variable `NUCLEUS_SKIP_SSL_VERIFY` to skip SSL verification on requests
1822

19-
2023
## [0.17.0](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.17.0) - 2024-02-06
2124

2225
### Added
@@ -26,11 +29,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2629
### Fixes
2730
- Fix test `test_models.test_remove_invalid_tag_from_model`
2831

29-
## [0.17.1] - 2024-02-22
30-
31-
### Added
32-
- Environment variable `NUCLEUS_SKIP_SSL_VERIFY` to skip SSL verification on requests
33-
3432
## [0.16.18](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.16.18) - 2024-02-06
3533

3634
### Added

nucleus/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io
44
import json
55
import os
6+
import urllib.request
67
import uuid
78
from collections import defaultdict
89
from typing import IO, TYPE_CHECKING, Dict, List, Sequence, Tuple, Type, Union
@@ -381,9 +382,14 @@ def serialize_and_write_to_presigned_url(
381382
):
382383
"""This helper function can be used to serialize a list of API objects to NDJSON."""
383384
request_id = uuid.uuid4().hex
385+
route = f"dataset/{dataset_id}/signedUrl/{request_id}"
386+
if os.environ.get("S3_ENDPOINT") is not None:
387+
route += "?s3Endpoint=" + urllib.request.pathname2url(
388+
os.environ["S3_ENDPOINT"]
389+
)
384390
response = client.make_request(
385391
payload={},
386-
route=f"dataset/{dataset_id}/signedUrl/{request_id}",
392+
route=route,
387393
requests_command=requests.get,
388394
)
389395

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.2"
28+
version = "0.17.3"
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)