anancarv / python-artifactory

Typed interactions with the Jfrog Artifactory REST API
MIT License
55 stars 50 forks source link

Add a method to find out whether an artifact exists #93

Closed janhollevoet closed 3 weeks ago

janhollevoet commented 3 years ago

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.

anancarv commented 3 years ago

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")
bdsoha commented 1 year ago

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