Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace requests with urllib3 #333

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

refactor: replace requests with urllib3 #333

wants to merge 7 commits into from

Conversation

woodruffw
Copy link
Collaborator

@woodruffw woodruffw commented Jan 8, 2025

(WIP; haven't rewritten the GCP tests yet.)

This simplifies our dependency tree a bit,
since requests is built on urllib3 internally.

It also chips away at a larger plan to replace
requests with urllib3 in sigstore-python, per
sigstore/sigstore-python#1040.

This simplifies our dependency tree a bit,
since requests is built on urllib3 internally.

It also chips away at a larger plan to replace
requests with urllib3 in sigstore-python, per
sigstore/sigstore-python#1040.

Signed-off-by: William Woodruff <[email protected]>
@woodruffw woodruffw self-assigned this Jan 8, 2025
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@woodruffw woodruffw marked this pull request as ready for review January 8, 2025 17:22
Signed-off-by: William Woodruff <[email protected]>
Copy link
Contributor

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me technically.

Should note that this PR switches the certificate store that id uses, see discussion in sigstore/sigstore-python#1040.

else:
assert False

u3 = pretend.stub(request=_request, exceptions=pretend.stub(MaxRetryError=ValueError))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you avoid exceptions arg here by raising MaxRetryError in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you avoid exceptions arg here by raising MaxRetryError in the first place?

Unfortunately not: this happens because I stub out the entire urllib3 package, so urllib3.exeptions.MaxRetryError would no longer be the "same" type. I could probably do a more precise stub instead, but MaxRetryError is also an annoying one to raise in tests (since it needs to be initialized with a URL, connection pool, response, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants