Skip to content

[Feature Request]: Allow changing default settings #40

@ytinyui

Description

@ytinyui

Describe the feature / enhancement and how it would improve things

Currently, changing the values in tls_requests.settings has no effect because the default argument values are set only once at the time the function is defined.
Enabling this feature allows users to modify the default configuration without explicitly specifying the reverent arguments in every function call.
If you agree on this suggestion, I can implement this and create a PR later.

Describe how your proposal will work, with code and/or pseudo-code

The default settings should be evaluated at the time when the function is called. For example, in tls_requests.api.request:

def request(
    ...,
    timeout: TimeoutTypes = None,
) -> Response:
    if timeout is None:
        timeout = DEFAULT_TIMEOUT
    ...

Then, running tls_requests.settings.DEFAULT_TIMEOUT = 60.0 would take effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions