Skip to content

config item to follow redirects by default #2597

@AntiSol

Description

@AntiSol

Hello.

I wasn't sure if I should reopen/comment on #2126 or make a new issue.

I've recently run into this change to the default behaviour around following redirects, and I'd like to be able to easily refactor my large codebase to set the default behaviour back. I'd also like be able to change the default to prevent other coders who may be unaware of this behaviour from inadvertently doing a get(url) without specifying follow_redirects (we almost always want to follow redirects in our codebase)

What I'd like to do is have a new config item in httpx._config similar to DEFAULT_MAX_REDIRECTS. This would be called something like DEFAULT_FOLLOW_REDIRECTS and would determine the default behaviour of follow_redirects is not provided

I'd like to do this to allow for usage like:

import httpx
httpx.DEFAULT_FOLLOW_REDIRECTS = True
httpx.get(some_url)

rather than having to either pass follow_redirects as a param to get or instantiate and persist a Client with follow_redirects=True

I think I could put together a PR to do this change, would that be likely to be accepted if I were to do so? Is there anything I should know before I write the code? :)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions