@@ -940,6 +940,73 @@ def add_customer(token, name = "", email = "", company_name="",\
940940 return (None , "Could not contact the server." )
941941
942942 return (jobj , "" )
943+
944+ @staticmethod
945+ def get_customer_licenses (token , customer_id , detailed = False , metadata = False ):
946+
947+ """
948+ This method will return a list of license keys that belong to a certain customer.
949+
950+ More docs: https://app.cryptolens.io/docs/api/v3/GetCustomerLicenses
951+ """
952+
953+ try :
954+ response = HelperMethods .send_request ("/customer/GetCustomerLicenses/" ,\
955+ {"token" :token ,\
956+ "customerId" : customer_id ,\
957+ "detailed" : detailed ,\
958+ "metadata" : metadata
959+ })
960+ except HTTPError as e :
961+ response = e .read ()
962+ except URLError as e :
963+ return (None , "Could not contact the server. Error message: " + str (e ))
964+ except Exception :
965+ return (None , "Could not contact the server." )
966+
967+ jobj = json .loads (response )
968+
969+ if jobj == None or not ("result" in jobj ) or jobj ["result" ] == 1 :
970+ if jobj != None :
971+ return (None , jobj ["message" ])
972+ else :
973+ return (None , "Could not contact the server." )
974+
975+ return (jobj , "" )
976+
977+ @staticmethod
978+ def get_customer_licenses_by_secret (token , secret , detailed = False , metadata = False ):
979+
980+ """
981+ This method will return a list of license keys that belong to a certain customer.
982+
983+ More docs: https://app.cryptolens.io/docs/api/v3/GetCustomerLicenses
984+ """
985+
986+ try :
987+ response = HelperMethods .send_request ("/customer/GetCustomerLicensesBySecret/" ,\
988+ {"token" :token ,\
989+ "secret" : secret ,\
990+ "detailed" : detailed ,\
991+ "metadata" : metadata
992+ })
993+ except HTTPError as e :
994+ response = e .read ()
995+ except URLError as e :
996+ return (None , "Could not contact the server. Error message: " + str (e ))
997+ except Exception :
998+ return (None , "Could not contact the server." )
999+
1000+ jobj = json .loads (response )
1001+
1002+ if jobj == None or not ("result" in jobj ) or jobj ["result" ] == 1 :
1003+ if jobj != None :
1004+ return (None , jobj ["message" ])
1005+ else :
1006+ return (None , "Could not contact the server." )
1007+
1008+ return (jobj , "" )
1009+
9431010
9441011class Data :
9451012
0 commit comments