Skip to content

config

dandy.http.config

HttpConnectorConfig

Bases: BaseConfig

Source code in dandy/http/config.py
def __init__(
        self,
        url: Url,
        headers: Union[dict, None] = None,
        basic_auth: Union[str, None] = None,
):
    self.url = url

    if headers is None:
        self.headers = {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
        }
    else:
        self.headers = headers

    if basic_auth is not None:
        self.headers['Authorization'] = f'Basic {self._encode_basic_auth(basic_auth)}'

    self.register_settings(
        'url',
        'headers',
        'basic_auth',
    )

url = url instance-attribute

headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} instance-attribute