session
#
Requests session configured with all accepted scheme adapters.
Classes#
The Base Transport Adapter |
|
Takes advice from requests/requests#1871 |
|
A Requests session. |
|
Base class that all auth implementations derive from |
Functions#
|
Given a URL, determine the channel it belongs to and return its name. |
|
Function that determines the correct Session object to be returned |
|
Function that determines which storage key to use for our CondaSession object caching |
Attributes#
- RETRIES = 3#
- CONDA_SESSION_SCHEMES#
- class EnforceUnusedAdapter#
Bases:
conda.gateways.connection.BaseAdapter
The Base Transport Adapter
- send(request, *args, **kwargs)#
Sends PreparedRequest object. Returns Response object.
- Parameters:
request -- The
PreparedRequest
being sent.stream -- (optional) Whether to stream the request content.
timeout (float or tuple) -- (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.
verify -- (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert -- (optional) Any user-provided SSL certificate to be trusted.
proxies -- (optional) The proxies dictionary to apply to the request.
- abstract close()#
Cleans up adapter specific items.
- get_channel_name_from_url(url: str) str | None #
Given a URL, determine the channel it belongs to and return its name.
- get_session(url: str)#
Function that determines the correct Session object to be returned based on the URL that is passed in.
- get_session_storage_key(auth) str #
Function that determines which storage key to use for our CondaSession object caching
- class CondaSessionType#
Bases:
type
Takes advice from requests/requests#1871 and creates one Session instance per thread.
- __call__(**kwargs)#
Call self as a function.
- class CondaSession(auth: conda.gateways.connection.AuthBase | tuple[str, str] | None = None)#
Bases:
conda.gateways.connection.Session
A Requests session.
Provides cookie persistence, connection-pooling, and configuration.
Basic Usage:
>>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') <Response [200]>
Or as a context manager:
>>> with requests.Session() as s: ... s.get('https://httpbin.org/get') <Response [200]>
- Parameters:
auth -- Optionally provide
requests.AuthBase
compliant objects
- classmethod cache_clear()#
- class CondaHttpAuth#
Bases:
conda.gateways.connection.AuthBase
Base class that all auth implementations derive from
- __call__(request)#
- static _apply_basic_auth(request)#
- static add_binstar_token(url)#
- static handle_407(response, **kwargs)#
Prompts the user for the proxy username and password and modifies the proxy in the session object to include it.
- This method is modeled after
requests.auth.HTTPDigestAuth.handle_401()
requests.auth.HTTPProxyAuth
the previous conda.fetch.handle_proxy_407()
It both adds 'username:password' to the proxy URL, as well as adding a 'Proxy-Authorization' header. If any of this is incorrect, please file an issue.