Response length doesn't match expected Content-Length Subclass of :class:`http.client.IncompleteRead` to allow int value for ``partial`` to avoid creating large objects on streamed reads.
| 259 | |
| 260 | |
| 261 | class IncompleteRead(HTTPError, httplib_IncompleteRead): |
| 262 | """ |
| 263 | Response length doesn't match expected Content-Length |
| 264 | |
| 265 | Subclass of :class:`http.client.IncompleteRead` to allow int value |
| 266 | for ``partial`` to avoid creating large objects on streamed reads. |
| 267 | """ |
| 268 | |
| 269 | partial: int # type: ignore[assignment] |
| 270 | expected: int |
| 271 | |
| 272 | def __init__(self, partial: int, expected: int) -> None: |
| 273 | self.partial = partial |
| 274 | self.expected = expected |
| 275 | |
| 276 | def __repr__(self) -> str: |
| 277 | return "IncompleteRead(%i bytes read, %i more expected)" % ( |
| 278 | self.partial, |
| 279 | self.expected, |
| 280 | ) |
| 281 | |
| 282 | |
| 283 | class InvalidChunkLength(HTTPError, httplib_IncompleteRead): |