-
Notifications
You must be signed in to change notification settings - Fork 4
/
RobStart.py
72 lines (57 loc) · 2.24 KB
/
RobStart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 19:23:22 2019
@author: KRDOKIM13
"""
import sys, requests
from requests.auth import HTTPDigestAuth
#import parse
class methods:
def __init__(self,host,username,password,payload,dataType):
self.host=host
self.username=username
self.password=password
self.payload=payload
self.dataType=dataType
self.digest_auth=HTTPDigestAuth(self.username,self.password)
self.session=requests.Session()
self.post_headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'}
def post(self):
#POST Method to update data
self.session.post(self.host,auth=self.digest_auth,headers=self.post_headers,data=self.payload)
#self.cookies='-http-session-={0}; ABBCX={1}'.format(temp.cookies['-http-session-'], resp.cookies['ABBCX']
def close(self):
self.close()
def main(argv):
try:
#host = 'http://192.168.125.1/rw/rapid/execution'
host = 'http://127.0.0.1/rw/rapid/execution'
tempHost = host + '?action=request'
dataType='mastershiprequest'
payload={}
ROB = methods(tempHost, 'Default User', 'robotics',payload,dataType)
ROB.post()
#host = 'http://192.168.125.1/rw/rapid/execution'
host = 'http://127.0.0.1/rw/rapid/execution'
#'http://192.168.125.1:80/rw/rapid/execution'
tempHost = host + '?action=resetpp' #reset pp to main
dataType='resetpp'
payload={}
ROB = methods(tempHost, 'Default User', 'robotics',payload,dataType)
ROB.post()
queryParameter = '?action=start' #execution start
host = host + queryParameter
dataType='exec'
runmode = 'forever'
payload = {'regain':'continue',
'execmode':'continue',
'cycle':runmode,
'condition':'none',
'stopatbp':'enabled',
'alltaskbytsp':'true'}
ROB = methods(host, 'Default User', 'robotics',payload,dataType)
ROB.post()
except KeyboardInterrupt:
ROB.close()
if __name__ == "__main__":
main(sys.argv[1:])