Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / function

_fetch_https

codeintel.source._fetch_https

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Called by (1)
SymbolFileResolved by
_loadsource.pysame file
Inside (1)
SymbolFileResolved by
sourcesource.pysame file
codeintel.source._fetch_httpsbackend/app/codeintel/source.py, lines 97–118Open source
def _fetch_https(url: str, token: str | None) -> bytes:    import httpx    host = urlsplit(url).hostname    if urlsplit(url).scheme != "https" or host not in RAW_CONTENT_HOSTS:        raise PermissionError(f"refusing to fetch from {host!r}")    headers = {}    if token and host == "raw.githubusercontent.com":        headers["Authorization"] = f"token {token}"    with httpx.Client(timeout=FETCH_TIMEOUT_SECONDS, follow_redirects=False) as client:        with client.stream("GET", url, headers=headers) as resp:            if resp.status_code == 404:                raise FileNotFoundError(url)            if resp.status_code != 200:                raise ConnectionError(f"HTTP {resp.status_code}")            chunks, size = [], 0            for part in resp.iter_bytes():                size += len(part)                if size > MAX_FETCH_BYTES:                    raise OverflowError("file too large")                chunks.append(part)    return b"".join(chunks)

What the index recorded

Signature
def _fetch_https(url: str, token: str | None) -> bytes:
File
backend/app/codeintel/source.py
Lines
97–118
Parser
python-ast
Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c
Call sites
11 named, 2 resolved, 9 left unlinked
Outside this subset
2 more edges reach code outside the graph shown here

Read it on GitHub at this commit