Esempio n. 1
0
    def create(self):
        resp = self.http_client.post(
            '/keys', '{}', headers={'content-type': 'application/json'})

        if resp.status_code >= 400:
            self._raise_api_exception(resp)

        return self.resource_class(self, base.extract_json(resp, None))
Esempio n. 2
0
    def create(self, app, config):
        self._ensure_not_empty(app=app)

        # If the specified definition is actually a file, read in the
        # definition file
        definition = utils.get_contents_if_file(config)

        resp = self.http_client.post('/apps/%s/servings' % app,
                                     definition,
                                     headers={'content-type': 'text/plain'})

        if resp.status_code >= 400:
            self._raise_api_exception(resp)

        return self.resource_class(self, base.extract_json(resp, None))
Esempio n. 3
0
    def logs(self, app, task, build):
        url = '/apps/%s/tasks/%s/%s/logs' % (app, task, build)

        resp = self.http_client.get(url)
        return base.extract_json(resp, None)