@@ -613,6 +613,45 @@ def get_products(token):
613613
614614 return (jobj ["products" ], "" )
615615
616+ @staticmethod
617+ def get_keys (token , product_id , page = 1 , order_by = "ID ascending" , search_query = "" ):
618+
619+ """
620+ This method will return a list of keys for a given product.
621+ Please keep in mind that although each license key will be
622+ of the License Key type, the fields related to signing operations
623+ will be left empty. Instead, if you want to get a signed license key
624+ (for example, to achieve offline key activation), please use the
625+ Activation method instead.
626+
627+ More docs: https://app.cryptolens.io/docs/api/v3/GetKeys
628+ """
629+
630+ try :
631+ response = HelperMethods .send_request ("/product/getkeys/" ,\
632+ {"token" :token ,\
633+ "ProductId" : product_id ,\
634+ "Page" : page ,\
635+ "OrderBy" : order_by ,\
636+ "SearchQuery" : search_query \
637+ })
638+ except HTTPError as e :
639+ response = e .read ()
640+ except URLError as e :
641+ return (None , "Could not contact the server. Error message: " + str (e ))
642+ except Exception :
643+ return (None , "Could not contact the server." )
644+
645+ jobj = json .loads (response )
646+
647+ if jobj == None or not ("result" in jobj ) or jobj ["result" ] == 1 :
648+ if jobj != None :
649+ return (None , jobj ["message" ])
650+ else :
651+ return (None , "Could not contact the server." )
652+
653+ return (jobj ["products" ], "" )
654+
616655
617656class Customer :
618657
0 commit comments