INNER CODE UNIT · Python
redirect_request
wolfSSL/wolfssl-examples · .github/scripts/ci_triage.py:123
def redirect_request(self, *a, **kw):
return None
_NOREDIR = urllib.request.build_opener(_NoRedirect)
def fetch_artifact(url):
"""Download an artifact zip.
The endpoint 302s to a pre-signed blob URL. urllib replays our Authorization
header onto it, the blob store then tries to authenticate with a GitHub token
and 401s -- so catch the redirect and fetch the Location with no auth.
Getting this wrong empties every result, which reads as "nothing failed".
"""
req = urllib.request.Request(url)
req.add_header("Authorization", f"Bearer {TOKEN}")
try: