Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Prepares and sends an HTTP request. Returns the response.
:param method: str
:param path: str
:return: response
:rtype: HTTPResponse
"""
if self._keep_alive and self.__session is None:
self.__session = requests.Session()
if self.__session is not None and not self._use_cookies:
self.__session.cookies.clear()
address = self._bake_address(path)
response = http.request(method, address, session=self.__session,
params=params, headers=headers, cookies=cookies, data=data, json=json,
allow_redirects=allow_redirects, timeout=timeout)
if self._auto_assert_ok:
response.assert_ok()
return response
def patch(address, **kwargs):
return http.request("PATCH", address, **kwargs)