Network Errors Handling

Network Errors

If a network request fails, Grab raises grab.error.GrabNetworkError. There are two situations when a network error exception will raise:

  • the server broke connection or the connection timed out

  • the response had any HTTP status code that is not 2XX or 404

Note particularly that 404 is a valid status code, and does not cause an exception to be raised.

Network Timeout

You can configure timeouts with the following options:

  • connect to server timeout with connect_timeout option

  • whole request/response operation timeout with timeout option

In case of a timeout, Grab raises grab.error.GrabTimeoutError.