cognitedata / cognite-sdk-python

Cognite Python SDK
https://cognite-sdk-python.readthedocs-hosted.com/
Apache License 2.0
76 stars 27 forks source link

files-api: join base-url and upload-url #1844

Closed HMEiding closed 1 month ago

HMEiding commented 1 month ago

Description

On Private Link projects, the "uploadUrl" does not contain the netloc portion of the URL. Updating FilesAPI.upload_from_bytes() so that the "uploadUrl" is joined with self._config.base_url whenever the netloc portion is missing.

Checklist:

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.43%. Comparing base (1f95e27) to head (4c3fec6).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1844 +/- ## ========================================== + Coverage 92.36% 92.43% +0.07% ========================================== Files 124 124 Lines 18497 18501 +4 ========================================== + Hits 17085 17102 +17 + Misses 1412 1399 -13 ``` | [Files](https://app.codecov.io/gh/cognitedata/cognite-sdk-python/pull/1844?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cognitedata) | Coverage Δ | | |---|---|---| | [cognite/client/\_api/files.py](https://app.codecov.io/gh/cognitedata/cognite-sdk-python/pull/1844?src=pr&el=tree&filepath=cognite%2Fclient%2F_api%2Ffiles.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cognitedata#diff-Y29nbml0ZS9jbGllbnQvX2FwaS9maWxlcy5weQ==) | `95.51% <100.00%> (+0.07%)` | :arrow_up: | | [cognite/client/\_version.py](https://app.codecov.io/gh/cognitedata/cognite-sdk-python/pull/1844?src=pr&el=tree&filepath=cognite%2Fclient%2F_version.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cognitedata#diff-Y29nbml0ZS9jbGllbnQvX3ZlcnNpb24ucHk=) | `100.00% <100.00%> (ø)` | | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/cognitedata/cognite-sdk-python/pull/1844/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cognitedata)
rbtcollins commented 1 month ago

I would prefer a unit test to demonstrate this behaviour, but I think the code change is right

qTipTip commented 1 month ago

I would prefer a unit test to demonstrate this behaviour, but I think the code change is right

I added two unit tests.