I need to check if a file exists. My approach until now was doing it via Artifactory REST API
url = https://artifactory.io/path_to_file/file.jar
headers = {'X-JFrog-Art-Api': 'api_key'}
response = requests.get(url, headers=headers)
assert(200 == response.status_code)
assert(response.text != "")
but there's a file that it too big and it's taking too long to get the response.
Is there another way to check if this file exists?
You could check the status code returned when getting the file info, not the file itself.
See the documentation of this REST API.
For example:
url = https://artifactory.io/api/storage/path_to_file/file.jar
headers = {'X-JFrog-Art-Api': 'api_key'}
response = requests.get(url, headers=headers)
assert(200 == response.status_code)
assert(response.text != "")
You can use one of the Search APIs or (and that is what I recommend) use the JFrog CLI search commands
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With