def createRequest(self, filename, target): document = Document() document.docName = os.path.basename(filename) payload = Payload() payload.doc.docName = document.docName header = Header() header.originator = Client._ORIGINATOR header.routing_id = 21 header.remainingHopCount=4 request = Request() request.header.originator = header.originator request.header.routing_id = header.routing_id request.header.remainingHopCount=header.remainingHopCount request.body.doc.docName = payload.doc.docName #request.body.doc.chunkContent = payload.doc.chunkContent #request.body.chunkContent = payload.chunkContent return request
def getListCourse(self): request=Request() payload=Payload() header=Header() header.routing_id=13 header.originator=Client._ORIGINATOR request.body.get_course.course_id=-1 request.header.routing_id=13 request.header.originator=Client._ORIGINATOR return request
def getCourseInfo(self,course_id): request=Request() payload=Payload() getcourse=GetCourse() header=Header() getcourse.course_id=course_id payload.get_course.course_id=getcourse.course_id header.routing_id=13 header.originator=Client._ORIGINATOR request.body.get_course.course_id=payload.get_course.course_id request.header.routing_id=13 request.header.originator=Client._ORIGINATOR return request
def createSign(self,user_name,password): request = Request() payload = Payload() sign_in=SignIn() header=Header() sign_in.user_name=user_name sign_in.password=password payload.sign_in.user_name=sign_in.user_name payload.sign_in.password=sign_in.password header.routing_id=13 header.originator=Client._ORIGINATOR request.body.sign_in.user_name= payload.sign_in.user_name request.body.sign_in.password=payload.sign_in.password request.header.routing_id=13 request.header.originator=Client._ORIGINATOR return request
def createRequest(self, msg): request = Request() payload = Payload() ping=Ping() header = Header() header.routing_id=2 header.originator=Client._ORIGINATOR ping.number=1 ping.tag=msg payload.ping.tag=ping.tag payload.ping.number=ping.number request.header.originator = header.originator request.header.routing_id = header.routing_id request.body.ping.tag=payload.ping.tag request.body.ping.number=payload.ping.number header.originator = Client._ORIGINATOR header.routing_id = 11 return request
def createSignUp(self,user_name,password,full_name): #print 'user' request = Request() payload = Payload() sign_up=SignUp() header=Header() sign_up.user_name=user_name sign_up.password=password sign_up.full_name=full_name payload.sign_up.user_name=sign_up.user_name payload.sign_up.password=sign_up.password payload.sign_up.full_name=sign_up.full_name header.routing_id=13 header.originator=Client._ORIGINATOR request.body.sign_up.user_name= payload.sign_up.user_name request.body.sign_up.password=payload.sign_up.password request.body.sign_up.full_name=payload.sign_up.full_name request.header.routing_id=13 request.header.originator=Client._ORIGINATOR return request