55from gql import Client , gql
66from gql .transport .requests import RequestsHTTPTransport
77
8- ###
9- #
10- # Things you might need to change
11- #
12- ###
13-
148# Your GUAC GraphQL server
9+ # TODO: Change this to where your graphQL server is running
1510GRAPHQL_SERVER = "http://localhost:8080/query"
1611
17- ###
18- #
19- # Things you probably won't need to change
20- #
21- ###
22-
2312def queryGuac ():
2413 '''
2514 Search the data in GUAC and return anything with CertifyLegal
@@ -53,12 +42,7 @@ def queryGuac():
5342 return licenseData
5443
5544def checkLicenses (licenseData ):
56- '''
57- Comments go here
58- '''
59-
6045 if sys .argv [1 :]:
61- # Oh, you want me to write to a file? Okay!
6246 outfile = open (sys .argv [1 ], 'w' , newline = '' )
6347 csvfile = csv .writer (outfile )
6448 csvfile .writerow (['Package' , 'Declared' , 'Discovered' ])
@@ -68,10 +52,8 @@ def checkLicenses(licenseData):
6852 discoveredLicense = licenseData [entry ][1 ]
6953 if declaredLicense != discoveredLicense :
7054 if sys .argv [1 :]:
71- # Write to the file
7255 csvfile .writerow ([entry ,declaredLicense , discoveredLicense ])
7356 else :
74- # Okay, just print to STDOUT
7557 print (entry )
7658 print ("\t Declares: " + licenseData [entry ][0 ])
7759 print ("\t Discovered: " + licenseData [entry ][1 ])
0 commit comments