[skip e2e] Add new func on utils (#13860)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
pull/13881/head
wt 2021-12-21 15:51:58 +08:00 committed by GitHub
parent b256a5b98a
commit 4b54710466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -276,3 +276,23 @@ def get_token(url):
token = ''
print("Can not get token.")
return token
def get_tags(url, token):
headers = {'Content-type': "application/json",
"charset": "UTF-8",
"Accept": "application/vnd.docker.distribution.manifest.v2+json",
"Authorization": "Bearer %s" % token}
try:
rep = requests.get(url, headers=headers)
data = json.loads(rep.text)
tags = []
if 'tags' in data:
tags = data["tags"]
else:
print("Can not get the tag list")
return tags
except:
print("Can not get the tag list")
return []