Exemple #1
0
    def make_request(self, request):
        method = request.method.upper()

        if method not in self.ALLOWED_HTTP_METHODS:
            raise HTTPMethodNotAllowedError(method, self.ALLOWED_HTTP_METHODS)

        return requests.request(
            method,
            request.url,
            headers=request.headers,
            params=request.params,
            json=request.body,
            allow_redirects=False,
        )
Exemple #2
0
    def http_method(self):
        method = self.spec.get(METHOD_KEY, "get").upper()
        if method not in self.ALLOWED_HTTP_METHODS:
            raise HTTPMethodNotAllowedError(method, self.ALLOWED_HTTP_METHODS)

        return method