@@ -39,22 +39,25 @@ def get_projects_from_org(organization: str, min_stars: int = 30) -> List[str]:
39
39
variables = {"organization" : organization }
40
40
41
41
try :
42
- request = requests .post (
42
+ response = requests .post (
43
43
"https://api.github.com/graphql" ,
44
44
json = {"query" : query , "variables" : variables },
45
45
headers = headers ,
46
46
)
47
- if request .status_code != 200 :
47
+ if response .status_code != 200 :
48
48
print (
49
49
"Unable to find GitHub org via GitHub api: "
50
50
+ organization
51
51
+ " ("
52
- + str (request .status_code )
52
+ + str (response .status_code )
53
53
+ ")"
54
54
)
55
55
return []
56
-
57
- github_org_info = Dict (request .json ()["data" ]["organization" ])
56
+ response_data = response .json ()
57
+ if "data" not in response_data :
58
+ print (f"Failed to get Github org data for { organization } " , response_data )
59
+ return []
60
+ github_org_info = Dict (response_data ["data" ]["organization" ])
58
61
except Exception as ex :
59
62
log .info (
60
63
"Failed to request GitHub org via GitHub api: " + organization ,
@@ -403,7 +406,9 @@ def extract_pypi_projects_from_requirements(
403
406
return projects
404
407
405
408
406
- def auto_extend_via_libio (projects : list ) -> list :
409
+ def auto_extend_via_libio (
410
+ projects : list , selected_package_manager : Optional [List [str ]] = None
411
+ ) -> list :
407
412
from pybraries .search import Search
408
413
409
414
updated_projects = []
@@ -429,6 +434,14 @@ def auto_extend_via_libio(projects: list) -> list:
429
434
project_id = None
430
435
id_property = None
431
436
437
+ if (
438
+ selected_package_manager
439
+ and platform not in selected_package_manager
440
+ ):
441
+ # Skip project
442
+ print (f"Platform { platform } is not selected -> Ignore." )
443
+ continue
444
+
432
445
if platform == "pypi" :
433
446
id_property = "pypi_id"
434
447
project_id = related_project ["name" ]
0 commit comments