In the readme, the following is provided as an example:
from artifactory import ArtifactoryPath
path = ArtifactoryPath(
"http://my_url:8080/artifactory/my_repo/winx64/aas", auth=("user", "password")
)
with path.archive(archive_type="zip", check_sum=False).open() as archive:
with open(r"D:\target.zip", "wb") as out:
out.write(archive.read())
# download folder archive in chunks
path.archive().writeto(out="my.zip", chunk_size=100 * 1024)
I am using the download as chunks method.
When I run it, I'm getting a 401 Unauthorized but I am using admin creds to test and so far every other operation like creation and querying has worked fine so I'm not sure what the problem is.
I verified the path I'm using for ArtifactoryPath is correct: https://myserver/artifactory/myrepo/path-to-my-folder-that-i-wanna-download and that fold does in fact exist and matches what is displayed in the UI.
The 401 exception that's being raised outputs a different url that I'm guessing is being derived from the URL above which looks like: https://myserver/api/archive/download/myrepo/path-to-my-folder-that-i-wanna-download?archiveType=tar.gz
I'm wondering if maybe I'm using the wrong path to start with or if it's being derived incorrectly? Or is there some other option or api i need to enable in artifactory (I'm not seeing one)?
Scrubbed stack trace
Traceback (most recent call last):
File "C:\source\my-company\my-tool\.venv\lib\site-packages\dohq_artifactory\exception.py", line 20, in raise_for_status
response.raise_for_status()
File "C:\source\my-company\my-tool\.venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://artifactory.my-company.com/artifactory/api/archive/download/domainservices-gke-nonprod-local/jeremy-test/some-repo/0-ab/my-test-component?archiveType=tar.gz
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\source\my-company\my-tool\my-tool\infrastructure\petm_artifactory\artifactory_util.py", line 129, in <module>
svc.download_component_artifacts(
File "C:\source\my-company\my-tool\my-tool\infrastructure\petm_artifactory\artifactory_util.py", line 100, in download_component_artifacts
arti_download_path\
File "C:\source\my-company\my-tool\.venv\lib\site-packages\artifactory.py", line 2432, in writeto
self._accessor.writeto(self, file, chunk_size, progress_func)
File "C:\source\my-company\my-tool\.venv\lib\site-packages\artifactory.py", line 1445, in writeto
response = self.get_response(pathobj)
File "C:\source\my-company\my-tool\.venv\lib\site-packages\artifactory.py", line 1124, in get_response
response = self.rest_get_stream(
File "C:\source\my-company\my-tool\.venv\lib\site-packages\artifactory.py", line 847, in rest_get_stream
raise_for_status(response)
File "C:\source\my-company\my-tool\.venv\lib\site-packages\dohq_artifactory\exception.py", line 39, in raise_for_status
raise ArtifactoryException(error_info_dict["message"]) from exception
dohq_artifactory.exception.ArtifactoryException: Unauthorized
In the readme, the following is provided as an example:
I am using the download as chunks method.
When I run it, I'm getting a 401 Unauthorized but I am using admin creds to test and so far every other operation like creation and querying has worked fine so I'm not sure what the problem is.
I verified the path I'm using for
ArtifactoryPath
is correct:https://myserver/artifactory/myrepo/path-to-my-folder-that-i-wanna-download
and that fold does in fact exist and matches what is displayed in the UI.The 401 exception that's being raised outputs a different url that I'm guessing is being derived from the URL above which looks like:
https://myserver/api/archive/download/myrepo/path-to-my-folder-that-i-wanna-download?archiveType=tar.gz
I'm wondering if maybe I'm using the wrong path to start with or if it's being derived incorrectly? Or is there some other option or api i need to enable in artifactory (I'm not seeing one)?
Scrubbed stack trace