Skip to content

Turning on/off Proxies via client method! #2188

@AmericanY

Description

@AmericanY
import trio
import httpx


proxies = {
    'all://': 'http:127.0.0.1:8866'
}


async def main():
    async with httpx.AsyncClient(timeout=10, proxies=proxies) as client:
        # how do i access proxies here which i previously set?
        # print(client.proxies)

        # imagine that i will do some operations here and then i would like to turn off proxies
        # client.proxies = False


if __name__ == "__main__":
    trio.run(main)

My question here is how can i access the proxies directly from the client same as we do for timeout or headers.

for example for timeout:

client.timeout = 20 will change the previous set of timeout .

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