Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download stat info for class accessor #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,24 @@ def get_stat_json(self, pathobj):

return json.loads(text)

def get_downloads_stat_json(self, pathobj):
"""
Request remote file/directory download info only
Returns a json object as specified by Artifactory REST API
"""
url = '/'.join([pathobj.drive,
'api/storage',
str(pathobj.relative_to(pathobj.drive)).strip('/'), '?stats'])

text, code = self.rest_get(url, auth=pathobj.auth, verify=pathobj.verify,
cert=pathobj.cert)
if code == 404 and "Unable to find item" in text:
raise OSError(2, "No such file or directory: '%s'" % url)
if code != 200:
raise RuntimeError(text)

return json.loads(text)

def stat(self, pathobj):
"""
Request remote file/directory status info
Expand Down