Returns the URL from a given connection. This is mainly used for testing and logging.
(
conn: HTTPConnection | HTTPSConnection, path: str | None = None
)
| 1090 | |
| 1091 | |
| 1092 | def _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 |