piwebasync/http/client.py
def _configure_hooks(
        self,
        safe_chars: str = None,
        event_hooks: Mapping[str, List[Callable]] = None,
    ) -> Mapping[str, List[Callable]]:

        """
        Configure event hooks to support safe chars if specified
        
        Raises:
            - TypeError: safe chars are wrong type
        """
        
        event_hooks = event_hooks or {}
        if safe_chars:
            if not isinstance(safe_chars, str):
                raise TypeError(
                    f"Invalid type for 'safe_chars'. Expected str, got {type(self.safe_chars)}"
                )
            hook = functools.partial(use_safe_url_hook, safe_chars)
            request_hooks = list(event_hooks.get("request", []))
            response_hooks = list(event_hooks.get("response", []))
            request_hooks.insert(0, hook)
            response_hooks.insert(0, hook)
            event_hooks.update(
                {
                    "request": request_hooks,
                    "response": response_hooks
                }
            )
        return event_hooks

        Configure event hooks to support safe chars if specified
        
        Raises:
            - TypeError: safe chars are wrong type
        
Configure event hooks to support safe chars if specified
Configure event hooks to support safe chars if specified
def _configure_hooks(
        self,
        safe_chars: str = None,
        event_hooks: Mapping[str, List[Callable]] = None,
    ) -> Mapping[str, List[Callable]]:
        event_hooks = event_hooks or {}
        if safe_chars:
            if not isinstance(safe_chars, str):
                raise TypeError(
                    f"Invalid type for 'safe_chars'. Expected str, got {type(self.safe_chars)}"
                )
            hook = functools.partial(use_safe_url_hook, safe_chars)
            request_hooks = list(event_hooks.get("request", []))
            response_hooks = list(event_hooks.get("response", []))
            request_hooks.insert(0, hook)
            response_hooks.insert(0, hook)
            event_hooks.update(
                {
                    "request": request_hooks,
                    "response": response_hooks
                }
            )
        return event_hooks
def _configure_hooks ( self , safe_chars : str = None , event_hooks : Mapping [ str , List [ Callable ] ] = None , ) -> Mapping [ str , List [ Callable ] ] : event_hooks = event_hooks or { } if safe_chars : if not isinstance ( safe_chars , str ) : raise TypeError ( f"Invalid type for 'safe_chars'. Expected str, got {type(self.safe_chars)}" ) hook = functools . partial ( use_safe_url_hook , safe_chars ) request_hooks = list ( event_hooks . get ( "request" , [ ] ) ) response_hooks = list ( event_hooks . get ( "response" , [ ] ) ) request_hooks . insert ( 0 , hook ) response_hooks . insert ( 0 , hook ) event_hooks . update ( { "request" : request_hooks , "response" : response_hooks } ) return event_hooks
Configure event hooks to support safe chars if specified
Configure event hooks to support safe chars if specified
"""
        Configure event hooks to support safe chars if specified
        
        Raises:
            - TypeError: safe chars are wrong type
        """
safe chars are wrong type
safe chars are wrong type
- TypeError
self
safe_chars
str
event_hooks
Mapping[str, List[Callable]]