diff --git a/Utils/TestSendRequest/Main.py b/Utils/TestSendRequest/Main.py new file mode 100644 index 00000000..7e9bc808 --- /dev/null +++ b/Utils/TestSendRequest/Main.py @@ -0,0 +1,24 @@ +#########Get settings############ +gSettings= None #Init variable +import Settings #Tool settings +gSettings = Settings.SettingsGet() +################################## +import requests #Lib for HTTP requests + +#Create HTTP session +lSession = requests.Session() +lResponse = None +#If GET +if gSettings["Method"].upper()=="GET": + lResponse = lSession.get(gSettings["URL"], headers=gSettings["Headers"], cookies=gSettings["Cookies"], verify=False, json = gSettings["JSON"]) +#If POST +elif gSettings["Method"].upper()=="POST": + lResponse = lSession.post(gSettings["URL"], headers=gSettings["Headers"], cookies=gSettings["Cookies"], verify=False, json = gSettings["JSON"]) + +print(f'SessionObject: {lResponse}, Body: {lResponse.text}') + +#Debug section +while True: + lCommand = input("Write Python cmd:") #Wait for python command + exec(lCommand) #Execute the command + \ No newline at end of file diff --git a/Utils/TestSendRequest/SendRequest.cmd b/Utils/TestSendRequest/SendRequest.cmd new file mode 100644 index 00000000..4da21971 --- /dev/null +++ b/Utils/TestSendRequest/SendRequest.cmd @@ -0,0 +1,3 @@ +cd %~dp0 +..\..\Resources\OpenRPA\v1.0.38\python-3.7.2.amd64\python.exe "Main.py" +pause >nul \ No newline at end of file diff --git a/Utils/TestSendRequest/Settings.py b/Utils/TestSendRequest/Settings.py new file mode 100644 index 00000000..4e6b8db5 --- /dev/null +++ b/Utils/TestSendRequest/Settings.py @@ -0,0 +1,11 @@ +import json +def SettingsGet(): + #Init config + lResult = { + "URL":"http://localhost:8081/SQLInsert", #Server host, example "http://localhost" Without / in the end + "Method":"POST", #Method to send HTTP (GET, POST...) + "Headers":{}, #Dictionary + "Cookies":{}, #Dictionary + "JSON":[{"TableName":"Test", "RowDict":{"Name":"Name1","Description":"DescTest", "Money":100, "Date":"01.01.2020"}}] #JSON data + } + return lResult \ No newline at end of file