Skip to content

Commit

Permalink
[LT-5283] Fix downloading dataset version export URLs (#180)
Browse files Browse the repository at this point in the history
### Why
* Recent API change: dataset version export URLs are now served through SDH

### How
* Add authorization for SDH urls
  • Loading branch information
moldovan-clarifai committed May 21, 2024
1 parent fe99502 commit 22b717e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/client/test_dataset_version_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import zipfile

from clarifai_grpc.grpc.api import service_pb2_grpc, service_pb2, resources_pb2
from tests.client.test_secure_data_hosting import get_secure_hosting_url
from tests.common import (
DOG_IMAGE_URL,
TRUCK_IMAGE_URL,
Expand Down Expand Up @@ -171,7 +172,10 @@ def _check_export(export, expected_format, expected_mimetype, check_fn):
assert export.format == expected_format
assert export.size > 0

get_export_url_response = requests.get(export.url)
headers = None
if export.url.startswith(get_secure_hosting_url()):
headers = metadata()
get_export_url_response = requests.get(export.url, headers=headers)
assert get_export_url_response.status_code == 200

with zipfile.ZipFile(io.BytesIO(get_export_url_response.content)) as zip_file:
Expand Down

0 comments on commit 22b717e

Please sign in to comment.