def request()

in src/openwhisk/openwhisk.py [0:0]


    def request(self, method, path, options):
        url = self.path_url(path)
        params = options['qs'] if 'qs' in options else None
        body = options['body'] if 'body' in options else None

        serializer = options['serializer'] if 'serializer' in options else None
        payload = json.dumps(body, default=serializer)
        headers = { 'Authorization': self.auth_header(), 'Content-Type': 'application/json' }
        verify = not self.options['ignore_certs']

        resp = requests.request(method, url, params=params, data=payload, headers=headers, verify=verify)

        if resp.status_code >= 400:
            # we turn >=400 statusCode responses into exceptions
            error = Exception()
            error.status_code = resp.status_code
            error.error = resp.json()
            raise error
        else:
            # otherwise, the response body is the expected return value
            return resp.json()