Skip to content

Commit a4f9b13

Browse files
committed
Add an option to run with SSL turned off
1 parent 8cefb21 commit a4f9b13

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

licensing/internal.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import hashlib
1010
import subprocess
1111
import os, os.path
12+
import ssl
1213

1314
def subprocess_args(include_stdout=True):
1415
if hasattr(subprocess, 'STARTUPINFO'):
@@ -34,6 +35,8 @@ class HelperMethods:
3435

3536
server_address = "https://app.cryptolens.io/api/"
3637

38+
verify_SLL = True
39+
3740
@staticmethod
3841
def get_SHA256(string):
3942
"""
@@ -119,10 +122,22 @@ def send_request(method, params):
119122
120123
method: the path of the method, eg. key/activate
121124
params: a dictionary of parameters
122-
"""
123-
return urllib.request.urlopen(HelperMethods.server_address + method, \
125+
"""
126+
127+
if HelperMethods.verify_SLL:
128+
return urllib.request.urlopen(HelperMethods.server_address + method, \
124129
urllib.parse.urlencode(params)\
125130
.encode("utf-8")).read().decode("utf-8")
131+
else:
132+
ctx = ssl.create_default_context()
133+
ctx.check_hostname = False
134+
ctx.verify_mode = ssl.CERT_NONE
135+
136+
return urllib.request.urlopen(HelperMethods.server_address + method, \
137+
urllib.parse.urlencode(params)\
138+
.encode("utf-8"), context=ctx).read().decode("utf-8")
139+
140+
126141

127142
@staticmethod
128143
def start_process(command, v = 1):

0 commit comments

Comments
 (0)