Python‎ > ‎requests‎ > ‎

requests.exceptions


Definition 
Handle exceptions to the requests and responses.

Syntax
requests.exceptions

Examples
The code return with the exception of HTTPError because URL error.
 >>> try:
...     r=requests.get('http://www.pythonlake.c/turtle',params='turtle')
...     t=r.text
...     print(t)
... except:
...     print(e)
...     
<class 'requests.exceptions.HTTPError'>


The request request is subject to the exception of ConnectionError in finding the turtle parameters in the www.pythonlake.com homepage.
>>> import requests
 >>> try:
...     r=requests.get('http://www.pythonlake.com',params='www.pythonlake.com')
...     t=r.text
...     t.find('turtle')
... except:
...     print(e)
...     
103986
>>> 


Comments