api
api
requests.api
~~~~~~~~~~~~
# By using the 'with' statement we are sure the session is closed, thus we
# avoid leaving sockets open which can trigger a ResourceWarning in some
# cases, and look like a memory leak in others.
with sessions.Session() as session:
return session.request(method=method, url=url, **kwargs)
kwargs.setdefault("allow_redirects", False)
return request("head", url, **kwargs)