(self, auth, url='')
Prepares the given HTTP auth data.
Prepares the given HTTP auth data.
Prepares the given HTTP auth data .
def prepare_auth(self, auth, url=''):
        """Prepares the given HTTP auth data."""

        # If no Auth is explicitly provided, extract it from the URL first.
        if auth is None:
            url_auth = get_auth_from_url(self.url)
            auth = url_auth if any(url_auth) else None

        if auth:
            if isinstance(auth, tuple) and len(auth) == 2:
                # special-case basic HTTP auth
                auth = HTTPBasicAuth(*auth)

            # Allow auth to make its changes.
            r = auth(self)

            # Update self to reflect the auth changes.
            self.__dict__.update(r.__dict__)

            # Recompute Content-Length
            self.prepare_content_length(self.body)
def prepare_auth ( self , auth , url = '' ) : # If no Auth is explicitly provided, extract it from the URL first. if auth is None : url_auth = get_auth_from_url ( self . url ) auth = url_auth if any ( url_auth ) else None if auth : if isinstance ( auth , tuple ) and len ( auth ) == 2 : # special-case basic HTTP auth auth = HTTPBasicAuth ( * auth ) # Allow auth to make its changes. r = auth ( self ) # Update self to reflect the auth changes. self . __dict__ . update ( r . __dict__ ) # Recompute Content-Length self . prepare_content_length ( self . body )