python-artifactory icon indicating copy to clipboard operation
python-artifactory copied to clipboard

Add a method to find out whether an artifact exists

Open janhollevoet opened this issue 4 years ago • 2 comments

Add a method that checks whether an artifact exists:

artifact_info = art.artifacts.exists("<ARTIFACT_PATH_IN_ARTIFACTORY>")

Currently, this can be done with the info method, combined with try/except.

janhollevoet avatar Jul 13 '21 07:07 janhollevoet

Hi @janhollevoet , This project is a wrapper for the Artifactory API. So we try to follow the API specification. The endpoint for checking whether an artifact exists is not defined within it, so we prefer not to add it. However, as you showed it earlier, it's still possible to perform such a check. I suggest you to write in your code something like that:

try
      artifact_info = art.artifacts.info("<ARTIFACT_PATH_IN_ARTIFACTORY>")
      ....
except ArtifactNotFoundException:
     ...
     log.error("Artifact does not exist")

anancarv avatar Jul 14 '21 14:07 anancarv

@janhollevoet Is this issue still relevant, or can it be closed?

bdsoha avatar Nov 21 '22 05:11 bdsoha