# parse_url_with_auth

> **Function** in `langchain_ollama`

📖 [View in docs](https://reference.langchain.com/python/langchain-ollama/_utils/parse_url_with_auth)

Parse URL and extract `userinfo` credentials for headers.

Handles URLs of the form: `https://user:password@host:port/path`

Scheme-less URLs (e.g., `host:port`) are also accepted and will be
given a default `http://` scheme.

## Signature

```python
parse_url_with_auth(
    url: str | None,
) -> tuple[str | None, dict[str, str] | None]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `url` | `str \| None` | Yes | The URL to parse. |

## Returns

`str | None`

A tuple of `(cleaned_url, headers_dict)` where:

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/fb6ab993a73180538f6cca876b3c85d46c08845f/libs/partners/ollama/langchain_ollama/_utils.py#L77)