Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def request(
self,
method: str,
url: URLTypes,
*,
data: RequestData = b"",
query_params: QueryParamTypes = None,
headers: HeaderTypes = None,
stream: bool = False,
allow_redirects: bool = True,
ssl: SSLConfig = None,
timeout: TimeoutConfig = None,
) -> SyncResponse:
request = Request(
method, url, data=data, query_params=query_params, headers=headers
)
self.prepare_request(request)
response = self.send(
request,
stream=stream,
allow_redirects=allow_redirects,
ssl=ssl,
timeout=timeout,
)
return response
def build_redirect_request(self, request: Request, response: Response) -> Request:
method = self.redirect_method(request, response)
url = self.redirect_url(request, response)
headers = self.redirect_headers(request, url)
content = self.redirect_content(request, method)
return Request(method=method, url=url, headers=headers, data=content)