コード例 #1
0
ファイル: feedback.py プロジェクト: tofficer/python
 def save(self):
     if self.id:
         raise Exception("Feedback is immutable")
     (results, response) = request('POST',
                                   '/evaluation/%s/feedback' % (self.evid),
                                   self.properties)
     self.id = results['id']
     self.createdAt = results['createdAt']
コード例 #2
0
 def __create(self):
     payload = {
         'inputs': self.inputs,
         'outputs': self.outputs,
         'rules': self.rules
     }
     if self.name:
         payload['name'] = self.name
     (results, response) = request('POST', '/agent', payload)
     self.__fromResults(results)
コード例 #3
0
ファイル: agent.py プロジェクト: tofficer/python
 def __create(self):
     payload = {
         'inputs': self.inputs,
         'outputs': self.outputs,
         'rules': self.rules
     }
     if self.name:
         payload['name'] = self.name
     (results, response) = request('POST', '/agent', payload)
     self.__fromResults(results)
コード例 #4
0
ファイル: client.py プロジェクト: EdwardBetts/infogami
 def request(self, sitename, path, method='GET', data=None):
     import server
     path = "/" + sitename + path
     web.ctx.infobase_auth_token = self.get_auth_token()
     try:
         out = server.request(path, method, data)
         if 'infobase_auth_token' in web.ctx:
             self.set_auth_token(web.ctx.infobase_auth_token)
     except common.InfobaseException, e:
         self.handle_error(e.status, str(e))
コード例 #5
0
    def evaluate_with_id(self, inputs):
        """Make a fuzzy evaluation.

        Arguments:
        inputs -- a dictionary mapping string input names to float values.

        Returns a 2-tuple: a dictionary mapping string output names to float
        values, and a string for the evaluation ID.
        """
        (results, response) = request('POST', '/agent/%s' % self.id, inputs)
        return (results, response['x-evaluation-id'])
コード例 #6
0
ファイル: agent.py プロジェクト: tofficer/python
    def evaluate_with_id(self, inputs):
        """Make a fuzzy evaluation.

        Arguments:
        inputs -- a dictionary mapping string input names to float values.

        Returns a 2-tuple: a dictionary mapping string output names to float
        values, and a string for the evaluation ID.
        """
        (results, response) = request('POST', '/agent/%s' % self.id, inputs)
        return (results, response['x-evaluation-id'])
コード例 #7
0
 def get(self):
     """Get the full Agent information from the server."""
     try:
         (results, response) = request('GET', '/agent/%s' % self.id)
         self.__fromResults(results)
     except HTTPError as err:
         if err.status == 404:
             raise NoSuchAgentError(self.id)
         elif err.status == 410:
             raise DeletedAgentError(self.id)
         else:
             raise err
コード例 #8
0
ファイル: agent.py プロジェクト: tofficer/python
 def get(self):
     """Get the full Agent information from the server."""
     try:
         (results, response) = request('GET', '/agent/%s' % self.id)
         self.__fromResults(results)
     except HTTPError as err:
         if err.status == 404:
             raise NoSuchAgentError(self.id)
         elif err.status == 410:
             raise DeletedAgentError(self.id)
         else:
             raise err
コード例 #9
0
ファイル: client.py プロジェクト: rlugojr/infogami
 def request(self, sitename, path, method='GET', data=None):
     import server
     path = "/" + sitename + path
     web.ctx.infobase_auth_token = self.get_auth_token()
     try:
         stats.begin("infobase", path=path, method=method, data=data)
         out = server.request(path, method, data)
         stats.end()
         if 'infobase_auth_token' in web.ctx:
             self.set_auth_token(web.ctx.infobase_auth_token)
     except common.InfobaseException, e:
         stats.end(error=True)
         self.handle_error(e.status, str(e))
コード例 #10
0
ファイル: client.py プロジェクト: BrychDaneel/isob_labs
TGS_enc_len = ticket[0] * 256 + ticket[1]
TGS_enc = ticket[2:2 + TGS_enc_len]
K_c_ss, = unpack("Q", ticket[2 + TGS_enc_len:])

print("TGS_enc:\n{}\n".format(TGS_enc))
print("K_c_ss: {}".format(K_c_ss))

request_time = int(time.time())
auth2 = pack("QQ", my_id, request_time)
auth2_enc = des.encrypt(auth2, K_c_ss)
print("AUTH2:\n{}\n".format(auth2))
print("AUTH2 x K_c_ss:\n{}\n".format(auth2_enc))

print("REQUEST TO SERVER")
responce_enc = server.request(TGS_enc, auth2_enc)

responce = des.decrypt(responce_enc, K_c_ss)
resp_time, = unpack("Q", responce)

print("Print server responce X K_c_ss: \n{}\n".format(responce_enc))
print("Print server responce: \n{}\n".format(responce))

print("*" * 60)
print("Send time: ", request_time)
print("Recv time: ", resp_time)

if resp_time != request_time + 1:
    print("ERROR")
    exit(1)
コード例 #11
0
 def delete(self):
     """Delete an agent from the server."""
     request('DELETE', '/agent/%s' % self.id)
コード例 #12
0
ファイル: agent.py プロジェクト: tofficer/python
 def delete(self):
     """Delete an agent from the server."""
     request('DELETE', '/agent/%s' % self.id)
コード例 #13
0
ファイル: feedback.py プロジェクト: tofficer/python
 def save(self):
     if self.id:
         raise Exception("Feedback is immutable")
     (results, response) = request('POST', '/evaluation/%s/feedback' % (self.evid), self.properties)
     self.id = results['id']
     self.createdAt = results['createdAt']
コード例 #14
0
def index():
    data = request()
    return jsonify(data)
コード例 #15
0
ファイル: evaluation.py プロジェクト: tofficer/python
 def feedback(self):
     (results, headers) = request("GET", "/evaluation/%s/feedback" % (self.id,))
     return results
コード例 #16
0
ファイル: evaluation.py プロジェクト: tofficer/python
 def get(self):
     (results, headers) = request("GET", "/evaluation/%s" % (self.id,))
     self.__fromResults(results)