mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
build_manifest.py: Handle bad requests
This commit is contained in:
parent
10b1812e70
commit
412d980b62
1 changed files with 8 additions and 1 deletions
|
@ -56,8 +56,12 @@ CURRENT_BRANCH: str = os.environ['CI_COMMIT_REF_NAME']
|
|||
def request_raw(path: str, token: str, project_url: str) -> List[Dict[str, str]]:
|
||||
gitlab_header: Dict[str, str] = {'JOB_TOKEN': token }
|
||||
base_url: str = get_hostname(project_url)
|
||||
resp = requests.get(f"https://{base_url}/api/v4/" + path, headers=gitlab_header)
|
||||
|
||||
return requests.get(f"https://{base_url}/api/v4/" + path, headers=gitlab_header).json()
|
||||
if not resp.ok:
|
||||
return None
|
||||
|
||||
return resp.json()
|
||||
|
||||
|
||||
def request(path: str) -> List[Dict[str, str]]:
|
||||
|
@ -97,6 +101,9 @@ def test_get_project_branch():
|
|||
failure = get_project_branch(id, 'why-would-anyone-chose-this-branch-name')
|
||||
assert failure is None
|
||||
|
||||
failure2 = get_project_branch("invalid-id", '1.12')
|
||||
assert failure2 is None
|
||||
|
||||
|
||||
# Documentation: https://docs.gitlab.com/ce/api/projects.html#list-user-projects
|
||||
def search_user_namespace(user: str, project: str) -> Dict[str, str]:
|
||||
|
|
Loading…
Reference in a new issue