urllib module defines the error exception is generated by the request module, avoids problems due to error and terminates the program.
1.URLError
OSError inheritance class is the base class module abnormal error, exceptions can be handled by the class generated by the capture request module. Properties reason, return the wrong reasons.
2.HTTPError
URLError subclasses, specifically HTTP request handling errors, such as authentication failure and the like. Attributes:
reason: Returns the cause of the error;
code: HTTP status code;
headers: returns the requested head