41
41
import requests
42
42
except Exception as e :
43
43
print e
44
- #sys.exit()
44
+ # sys.exit()
45
45
46
46
47
47
class MiniProbe (object ):
@@ -53,7 +53,7 @@ def __init__(self):
53
53
logging .basicConfig (
54
54
filename = "./logs/probe.log" ,
55
55
filemode = "a" ,
56
- # level=logging.DEBUG,
56
+ # level=logging.DEBUG,
57
57
level = logging .INFO ,
58
58
format = "%(asctime)s - %(levelname)s - %(message)s" ,
59
59
datefmt = '%m/%d/%Y %H:%M:%S'
@@ -116,17 +116,21 @@ def create_parameters(self, config, jsondata, i=None):
116
116
else :
117
117
return {'gid' : config ['gid' ], 'key' : self .hash_access_key (config ['key' ]), 'protocol' : config ['protocol' ]}
118
118
119
- def create_url (self , config , i = None ):
119
+ def create_url (self , config , i = None , http = False ):
120
120
"""
121
121
creating the actual URL
122
122
"""
123
+ prefix = "https"
124
+ if http :
125
+ prefix = "http"
126
+
123
127
if not (i is None ) and (i != "data" ):
124
- return "https ://%s:%s/probe/%s" % (
125
- config ['server' ], config ['port' ], i )
128
+ return "%s ://%s:%s/probe/%s" % (
129
+ prefix , config ['server' ], config ['port' ], i )
126
130
elif i == "data" :
127
- return "https ://%s:%s/probe/%s?gid=%s&protocol=%s&key=%s" % (config ['server' ], config ['port' ], i ,
128
- config ['gid' ], config ['protocol' ],
129
- self .hash_access_key (config ['key' ]))
131
+ return "%s ://%s:%s/probe/%s?gid=%s&protocol=%s&key=%s" % (prefix , config ['server' ], config ['port' ], i ,
132
+ config ['gid' ], config ['protocol' ],
133
+ self .hash_access_key (config ['key' ]))
130
134
pass
131
135
else :
132
136
return "No method given"
0 commit comments