Skip to content

Conversation

@woodruffw
Copy link
Member

This drops our requests dependency in favor of directly using urllib3, which we already depend on indirectly.

This should be an internal change only, no public changes are expected.

Half me, half Claude.

CC @pnacht for viz; this will unblock us using urllib3.util.Retry 🙂

Closes #1148.

@woodruffw woodruffw requested review from di and jku January 12, 2026 21:34
@woodruffw woodruffw self-assigned this Jan 12, 2026
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@jku jku linked an issue Jan 14, 2026 that may be closed by this pull request
Copy link
Member

@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 about right.

The changelog item should mention that this changes the root certificate source (for TLS, not for sigstore specific roots).

I feel like this does not help me that much if I want to see what timeouts and retries are currently used... Should the pool explicitly set the defaults for both of those so it would be clear (unless of course a specific component overrides e.g. the timeout value)?

# Build fields for query parameters
fields = None
if params:
fields = params
Copy link
Member

Choose a reason for hiding this comment

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

fields seems like a useless variable here?

# Create timeout object if specified
timeout_obj = None
if timeout is not None:
timeout_obj = urllib3.Timeout(connect=timeout, read=timeout)
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this changes anything in practice but in urllib3 the timeout argument default value is not None but a separate placeholder, yet we always set None here.

That said, maybe we should set an actual timeout default here to make it clear?

session.headers.update(
{
"Content-Type": "application/json",
"Accept": "application/json",
Copy link
Member

Choose a reason for hiding this comment

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

Accept header is no longer set I think -- does this matter?

headers = {
"Authorization": f"Basic {encoded_credentials}",
"Content-Type": "application/x-www-form-urlencoded",
}
Copy link
Member

Choose a reason for hiding this comment

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

urllib3.util.make_headers(basic_auth=f"{auth[0]}:{auth[1]}") might be a less involved way to do this

resp: requests.Response = self.session.get(oidc_config_url, timeout=30)
except (requests.ConnectionError, requests.Timeout) as exc:
resp = http.get(oidc_config_url, timeout=30)
except (urllib3.exceptions.HTTPError, urllib3.exceptions.TimeoutError) as exc:
Copy link
Member

Choose a reason for hiding this comment

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

No need to explicitly handle urllib3.exceptions.TimeoutError here, it's an HTTPError.

Applies to all other uses

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.

Retry requests to rekor, fulcio ? Refactor: replace requests with urllib3

3 participants