O'Reilly logo

Python Requests Essentials by Bala Subrahmanyam Varanasi, Rakesh Vidya Chandra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Errors and exceptions

Different types of errors and exceptions will be raised when something goes wrong in the process of sending a request and getting back a response. Some of them are as follows:

  • HTTPError: When there are invalid HTTP responses, Requests will raise an HTTPError exception
  • ConnectionError: If there is a network problem, such as refused connection and DNS failure, Requests will raise a ConnectionError exception
  • Timeout: If the request gets timed out, this exception will be raised
  • TooManyRedirects: If the request surpasses the configured number of maximum redirections, this type of exception is raised

Other types of exception that come in to the picture are Missing schema Exception, InvalidURL, ChunkedEncodingError, and ContentDecodingError ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required