harbor/tests/apitests/python/library/referrers_api.py
Yang Jiao 97c1fdcd8e
Add Referrers API testcase (#18775)
Fix #18617

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
2023-06-01 16:34:40 +08:00

13 lines
555 B
Python

# -*- coding: utf-8 -*-
import requests
def call(server, project_name, repo_name, digest, artifactType=None, **kwargs):
url=None
auth = (kwargs.get("username"), kwargs.get("password"))
if artifactType:
artifactType = artifactType.replace("+", "%2B")
url="https://{}/v2/{}/{}/referrers/{}?artifactType={}".format(server, project_name, repo_name, digest, artifactType)
else:
url="https://{}/v2/{}/{}/referrers/{}".format(server, project_name, repo_name, digest)
return requests.get(url, auth=auth, verify=False)