Turning on/off Proxies via client method!

Open
#682 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python
Domain
api, backend

Research direction

Start by examining how httpx.AsyncClient accepts and stores the proxies argument, including the client lifecycle shown in the example. Define the expected public behavior for inspecting and turning proxies off after initialization, then add coverage demonstrating proxy use followed by disabled-proxy operations.

Written by the indexing model from the issue text.

Description

Originally opened by @AmericanY on 2022-04-23 03:49:12 in encode/httpx

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)
Dominant language
Python
Stars
1.6k
Forks
103
Avg merge
1d 19h
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pydantic/httpx2

All issues in pydantic/httpx2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.