Skip to content

Commit 4f11d28

Browse files
committed
Fix error handling in Python 2 and 3
1 parent 5374ca3 commit 4f11d28

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cryptolens_python2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def create_trial_key(token, product_id, machine_code):
313313
"ProductId":product_id,\
314314
"MachineCode":machine_code})
315315
except HTTPError as e:
316-
response = Response.from_string(e.read())
316+
response = e.read()
317317
except URLError as e:
318318
return (None, "Could not contact the server. Error message: " + str(e))
319319
except Exception:
@@ -351,7 +351,7 @@ def deactivate(token, product_id, key, machine_code, floating = False):
351351
"Floating" : floating,\
352352
"MachineCode":machine_code})
353353
except HTTPError as e:
354-
response = Response.from_string(e.read())
354+
response = e.read()
355355
except URLError as e:
356356
return (None, "Could not contact the server. Error message: " + str(e))
357357
except Exception:

licensing/methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def create_trial_key(token, product_id, machine_code):
127127
"ProductId":product_id,\
128128
"MachineCode":machine_code})
129129
except HTTPError as e:
130-
response = Response.from_string(e.read())
130+
response = e.read()
131131
except URLError as e:
132132
return (None, "Could not contact the server. Error message: " + str(e))
133133
except Exception:
@@ -162,7 +162,7 @@ def deactivate(token, product_id, key, machine_code, floating = False):
162162
"Floating" : floating,\
163163
"MachineCode":machine_code})
164164
except HTTPError as e:
165-
response = Response.from_string(e.read())
165+
response = e.read()
166166
except URLError as e:
167167
return (None, "Could not contact the server. Error message: " + str(e))
168168
except Exception:
@@ -203,7 +203,7 @@ def get_web_api_log(token, product_id = 0, key = "", machine_code="", friendly_n
203203
"StartingAfter": starting_after,\
204204
"EndingBefore": ending_before})
205205
except HTTPError as e:
206-
response = Response.from_string(e.read())
206+
response = e.read()
207207
except URLError as e:
208208
return (None, "Could not contact the server. Error message: " + str(e))
209209
except Exception:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
setup(
33
name = 'licensing', # How you named your package folder (MyLib)
44
packages = ['licensing'], # Chose the same as "name"
5-
version = '0.19', # Start with a small number and increase it with every change you make
5+
version = '0.20', # Start with a small number and increase it with every change you make
66
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
77
description = 'Client library for Cryptolens licensing Web API.', # Give a short description about your library
88
author = 'Cryptolens AB', # Type in your name
99
author_email = '[email protected]', # Type in your E-Mail
1010
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_19.tar.gz', # I explain this later on
11+
download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_20.tar.gz', # I explain this later on
1212
keywords = ['software licensing', 'licensing library', 'cryptolens'], # Keywords that define your package best
1313
classifiers=[
1414
#'Development Status :: 5 - Stable', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package

0 commit comments

Comments
 (0)