Пример #1
0
def call_scheduler_api(path, params):
    host = "127.0.0.1"
    port = 9000
    base_url = "http://%s:%d/api" % (host, port)
    resp = requests.post(
        os.path.join(base_url, path), data=json.dumps(params), timeout=60)
    return json.loads(resp.content)
Пример #2
0
    def _params(self):
        """ Decode a params dictionary from the request body. """
        body = self.request.body.strip()
        if not body:
            return {}

        try:
            return json.loads(body)
        except json.JSONDecodeError as e:
            raise JSONDecodeError(str(e))