INNER CODE UNIT · Python

__call__

mistio/mist-ce · ci/release.py:82

    def __call__(self, url, method='GET', parse_json_resp=True,
                 api='https://api.github.com', **kwargs):
        url = '%s/repos/%s/%s%s' % (api, self.owner, self.repo, url)
        headers = kwargs.pop('headers', {})
        headers.update({'Authorization': 'token %s' % self.token})
        print("Will make %s request to %s: %s" % (method, url, kwargs))
        resp = requests.request(method, url, headers=headers, **kwargs)
        if not resp.ok:
            print(resp.status_code)
            print(resp.text)
            raise Exception(resp.status_code)
        if parse_json_resp:
            try:
                return resp.json()
            except Exception:
                print("Error decoding json response")
                print(resp.text)
                raise

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…