Skip to content
Permalink
Browse files
Merge pull request #717 from artm04/patch-2
Replace the params dict with the kwargs
  • Loading branch information
sergejey committed Mar 25, 2020
2 parents 9a48bf0 + 6be4ba0 commit 33f90f73ca7c13621e1a269f4b40e7e8c9fc3c08
Showing 1 changed file with 5 additions and 13 deletions.
@@ -15,9 +15,7 @@ def getURL(url):
response = urllib2.urlopen(url).read()
return response

def callAPI(api_url, method = "GET", params = ""):
if ((type(params) is not dict)):
params = {}
def callAPI(api_url, method = "GET", **params):

params['no_session']=1
url = re.sub(r"^/api/", BASE_URL+ROOTHTML+'api.php/', api_url)
@@ -34,20 +32,16 @@ def callAPI(api_url, method = "GET", params = ""):
#print the_page
return the_page

def runScript(script_name, params = ""):
if ((type(params) is not dict)):
params = {}
def runScript(script_name, **params):
callAPI("/api/script/"+script_name,"GET",params)
return 1

def callMethod(method_name, params = ""):
if ((type(params) is not dict)):
params = {}
def callMethod(method_name, **params):
callAPI("/api/method/"+method_name,"GET",params)
return 1

def setGlobal(property, value):
callAPI("/api/data/"+property, "POST", {"data":value})
callAPI("/api/data/"+property, "POST", data=value)
return 1

def sg(property, value):
@@ -87,8 +81,6 @@ def getProperty(self, property_name):
result = getGlobal(self.object_name+"."+property_name)
return result

def callMethod(self, method_name, params = ""):
if ((type(params) is not dict)):
params = {}
def callMethod(self, method_name, **params):
result = callMethod(self.object_name+"."+method_name, params)
return result

0 comments on commit 33f90f7

Please sign in to comment.