psf / psf/requests

Making https proxies easier to deal with

Open
#2,061 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
54.3k
Forks
10.5k
Avg merge
16h 43m
Merged PRs (30d)
3

Description

I'm trying to add support for proxies to conda, in particular, automatically prompting for a username and password on a 407. For http proxies, it's all fine. I can detect the 407 error code on HTTPError from raise_for_status and inject HTTPProxyAuth and try again.

But for https, it raises ConnectionError on get. Adding HTTPProxyAuth does not work. I have to parse the URL and add it in as https://username:password@proxy:port. urlparse does not make this particularly easy.

Furthermore, the only way I can tell to actually detect the the ConnectionError is a 407 is to do

try:
    # do request
except ConnectionError as e:
    if "407" in str(e):
        # get username and password

Contributor guide

Open the contributing guide

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.

Research direction

Start by tracing the HTTPS proxy request path around get, ConnectionError, HTTPError, raise_for_status, and HTTPProxyAuth. Determine how a proxy authentication response should be exposed and retried without relying on parsing exception text; done means HTTPS proxy authentication can be detected and handled consistently with HTTP proxies.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.