audeering / audfactory

Communicating with Artifactory
https://audeering.github.io/audfactory/
Other
0 stars 0 forks source link

audfactory.versions() might fail with 403 error #27

Closed hagenw closed 2 years ago

hagenw commented 2 years ago

When requesting a non existing path on a server it might fail differently for different user with different access rights:

import os
import audfactory

path = audfactory.path('https://artifactory.audeering.com/artifactory/data-private-local/crema-d/db')
versions = [os.path.basename(str(p)) for p in path if p.is_dir]

fails for me with

FileNotFoundError: [Errno 2] No such file or directory: 'https://artifactory.audeering.com/artifactory/api/storage/data-private-local/crema-d/db'

whereas for another user it failed with

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://artifactory.audeering.com/artifactory/api/storage/data-private-local/crema-d/db

This means we also have to catch the 403 error in audfactory.versions().