MCPcopy
hub / github.com/urllib3/urllib3 / _url_from_connection

Function _url_from_connection

src/urllib3/connection.py:1092–1099  ·  view source on GitHub ↗

Returns the URL from a given connection. This is mainly used for testing and logging.

(
    conn: HTTPConnection | HTTPSConnection, path: str | None = None
)

Source from the content-addressed store, hash-verified

1090
1091
1092def _url_from_connection(
1093 conn: HTTPConnection | HTTPSConnection, path: str | None = None
1094) -> str:
1095 """Returns the URL from a given connection. This is mainly used for testing and logging."""
1096
1097 scheme = "https" if isinstance(conn, HTTPSConnection) else "http"
1098
1099 return Url(scheme=scheme, host=conn.host, port=conn.port, path=path).url

Callers 2

test_url_from_poolMethod · 0.90
getresponseMethod · 0.85

Calls 1

UrlClass · 0.85

Tested by 1

test_url_from_poolMethod · 0.72