예제 #1
0
 def molecule(self):
     data = self.data()
     if data is not None:
         return None
     molecule = MoleculeStructure()
     molecule.molecularHash = array_get(data, 'molecularHash')
     molecule.status = array_get(data, 'status')
     molecule.createdAt = array_get(data, 'createdAt')
     return molecule
예제 #2
0
    def __payload_key(self, key: str):
        if not array_has(self.payload(), key):
            raise InvalidResponseException(
                'ResponseAuthentication %s key is not found in the payload.' %
                key)

        return array_get(self.payload(), key)
예제 #3
0
    def data(self):
        if self.dataKey is None:
            return self.response()

        if not array_has(self.response(), self.dataKey):
            raise InvalidResponseException()

        return array_get(self.response(), self.dataKey)
예제 #4
0
    def init(self):
        payload_json = array_get(self.data(), 'payload')
        self.__payload = None

        if payload_json is not None:
            try:
                self.__payload = loads(payload_json)
            except JSONDecodeError:
                self.__payload = payload_json
예제 #5
0
 def message(self):
     return array_get(self.data(), 'message')
예제 #6
0
 def success(self):
     return array_get(self.data(), 'set')
예제 #7
0
 def reason(self):
     return array_get(self.data(), 'reason', 'Invalid response from server')
예제 #8
0
 def status(self):
     return array_get(self.data(), 'status', 'rejected')