Raised when host name resolution fails.
| 164 | |
| 165 | |
| 166 | class NameResolutionError(NewConnectionError): |
| 167 | """Raised when host name resolution fails.""" |
| 168 | |
| 169 | def __init__(self, host: str, conn: HTTPConnection, reason: socket.gaierror): |
| 170 | message = f"Failed to resolve '{host}' ({reason})" |
| 171 | self._host = host |
| 172 | self._reason = reason |
| 173 | super().__init__(conn, message) |
| 174 | |
| 175 | def __reduce__(self) -> _TYPE_REDUCE_RESULT: |
| 176 | # For pickling purposes. |
| 177 | return self.__class__, (self._host, None, self._reason) |
| 178 | |
| 179 | |
| 180 | class EmptyPoolError(PoolError): |