Skip to content

Commit dfd3199

Browse files
author
Olivier Roussel
committed
handle query packages returns none
1 parent 1e51336 commit dfd3199

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/fetch_packages_names.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@
3434

3535
resp_json = response.json()
3636

37-
page = resp_json["data"]["package"]["variants"]["page"]
38-
3937
results = []
4038

41-
for pkg in page:
42-
# if python version is specified, filter only package files
43-
# that contains the python version substring (e.g. py310)
44-
if args.python:
45-
if py_str in pkg["filename"]:
39+
if resp_json["data"]["package"]:
40+
page = resp_json["data"]["package"]["variants"]["page"]
41+
42+
43+
for pkg in page:
44+
# if python version is specified, filter only package files
45+
# that contains the python version substring (e.g. py310)
46+
if args.python:
47+
if py_str in pkg["filename"]:
48+
results.append(pkg["filename"])
49+
else:
4650
results.append(pkg["filename"])
47-
else:
48-
results.append(pkg["filename"])
4951

5052
print(json.dumps(results))

0 commit comments

Comments
 (0)