licensing 0.43__tar.gz → 0.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: licensing
3
- Version: 0.43
3
+ Version: 0.45
4
4
  Summary: Client library for Cryptolens licensing Web API.
5
5
  Home-page: https://cryptolens.io
6
6
  Author: Cryptolens AB
7
7
  Author-email: support@cryptolens.io
8
8
  License: MIT
9
- Download-URL: https://github.com/Cryptolens/cryptolens-python/archive/v_42.tar.gz
9
+ Download-URL: https://github.com/Cryptolens/cryptolens-python/archive/v_45.tar.gz
10
10
  Description: UNKNOWN
11
11
  Keywords: software licensing,licensing library,cryptolens
12
12
  Platform: UNKNOWN
@@ -546,6 +546,74 @@ class Key:
546
546
  return (False, "Could not contact the server.")
547
547
 
548
548
  return (jobj["key"], jobj["rawResponse"], jobj["message"])
549
+
550
+ def add_feature(token, product_id, key, feature):
551
+ """
552
+ This method will set a certain feature (F1..F8) to true.
553
+ If the key algorithm in the product is SKGL, the key string will be
554
+ changed if necessary. Otherwise, if SKM15 is used, the key will stay
555
+ the same. To do the reverse, please see RemoveFeature.
556
+
557
+ More docs: https://app.cryptolens.io/docs/api/v3/AddFeature
558
+ """
559
+
560
+ response = ""
561
+
562
+ try:
563
+ response = HelperMethods.send_request("/key/AddFeature", {"token":token,\
564
+ "ProductId":product_id,\
565
+ "Key" : key,\
566
+ "Feature" : feature})
567
+ except HTTPError as e:
568
+ response = e.read()
569
+ except URLError as e:
570
+ return (None, "Could not contact the server. Error message: " + str(e))
571
+ except Exception:
572
+ return (None, "Could not contact the server.")
573
+
574
+ jobj = json.loads(response)
575
+
576
+ if jobj == None or not("result" in jobj) or jobj["result"] == 1:
577
+ if jobj != None:
578
+ return (False, jobj["message"])
579
+ else:
580
+ return (False, "Could not contact the server.")
581
+
582
+ return (True, jobj["message"])
583
+
584
+ def remove_feature(token, product_id, key, feature):
585
+ """
586
+ This method will set a certain feature (F1..F8) to false. If the key
587
+ algorithm in the product is SKGL, the key string will be changed if
588
+ necessary. Otherwise, if SKM15 is used, the key will stay the same.
589
+ To do the reverse, please see AddFeature.
590
+
591
+ More docs: https://app.cryptolens.io/docs/api/v3/RemoveFeature
592
+ """
593
+
594
+ response = ""
595
+
596
+ try:
597
+ response = HelperMethods.send_request("/key/RemoveFeature", {"token":token,\
598
+ "ProductId":product_id,\
599
+ "Key" : key,\
600
+ "Feature" : feature})
601
+ except HTTPError as e:
602
+ response = e.read()
603
+ except URLError as e:
604
+ return (None, "Could not contact the server. Error message: " + str(e))
605
+ except Exception:
606
+ return (None, "Could not contact the server.")
607
+
608
+ jobj = json.loads(response)
609
+
610
+ if jobj == None or not("result" in jobj) or jobj["result"] == 1:
611
+ if jobj != None:
612
+ return (False, jobj["message"])
613
+ else:
614
+ return (False, "Could not contact the server.")
615
+
616
+ return (True, jobj["message"])
549
617
 
550
618
  class AI:
551
619
 
@@ -872,6 +940,73 @@ class Customer:
872
940
  return (None, "Could not contact the server.")
873
941
 
874
942
  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
+
875
1010
 
876
1011
  class Data:
877
1012
 
@@ -2,13 +2,13 @@ from distutils.core import setup
2
2
  setup(
3
3
  name = 'licensing', # How you named your package folder (MyLib)
4
4
  packages = ['licensing'], # Chose the same as "name"
5
- version = '0.43', # Start with a small number and increase it with every change you make
5
+ version = '0.45', # Start with a small number and increase it with every change you make
6
6
  license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
7
7
  description = 'Client library for Cryptolens licensing Web API.', # Give a short description about your library
8
8
  author = 'Cryptolens AB', # Type in your name
9
9
  author_email = 'support@cryptolens.io', # Type in your E-Mail
10
10
  url = 'https://cryptolens.io', # Provide either the link to your github or to your website
11
- download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_42.tar.gz', # I explain this later on
11
+ download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_45.tar.gz', # I explain this later on
12
12
  keywords = ['software licensing', 'licensing library', 'cryptolens'], # Keywords that define your package best
13
13
  classifiers=[
14
14
  #'Development Status :: 5 - Stable', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
File without changes
File without changes
File without changes
File without changes