> ## Documentation Index
> Fetch the complete documentation index at: https://ctrlrun.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# urlopen

> `urllib.request.urlopen` for `http` and `https`, classified (SPEC-v0.7 §2.3).

`ctrlrun.transport.urlopen` — function, defined at `src/ctrlrun/transport.py:212`

```python theme={null}
from ctrlrun.transport import urlopen
```

```python theme={null}
def urlopen(url: str | urllib.request.Request, data: bytes | None = None, *, timeout: float | None = socket._GLOBAL_DEFAULT_TIMEOUT, context: ssl.SSLContext | None = None) -> http.client.HTTPResponse
```

`urllib.request.urlopen` for `http` and `https`, classified (SPEC-v0.7 §2.3).

Raises `NotExecuted`, chained from the original exception, only where the connection it opened
failed before any request byte was offered, in this call or earlier in the same executor run,
and only inside an executor run (`HTTPConnection` says why). Every other failure is `urllib`'s
own exception,
which the kernel records `AMBIGUOUS`: a reset or a timeout after the request was offered, a
proxy that refused a tunnel after its `CONNECT` line was sent, a malformed URL or an unknown
scheme (nothing was connected, so nothing is claimed).

**No redirect is followed.** A `POST` answered `303` may already have created what it points
to, so a `30x` is `urllib.error.HTTPError` like any other status, and no status is ever
`NotExecuted` (§2.4). Proxies from the environment are honoured, since the count is taken on
whatever socket the connection writes to. The opener carries the proxy, default-error and
error-processor handlers, the classifier's `http` and `https` handlers, and `urllib`'s
unknown-scheme handler, which only raises; it has no redirect, authentication, `ftp:`, `file:`
or `data:` handler, and no opener can be passed in.

The executor may still raise `NotExecuted` on its own evidence, such as a provider's documented
validation error; that is its claim, and the most dangerous integration bug there is an
executor that raises it after the remote acted.

## Next

* [Python API index](/docs/reference/api/index).
* [Get started](/docs/get-started/quickstart) · [Why](/docs/why).


## Related topics

- [Python API](/docs/reference/api/index.md)
- [ctrlrun verify](/docs/verify.md)
