ID EN
Urllib Request

add_handler

Python 3.11

handler should be an instance of BaseHandler. The following methods are searched, and added to the possible chains (note that HTTP errors are a special case). Note that, in the following, protocol should be replaced with the actual protocol to handle, for example http_response() would be the HTTP protocol response handler. Also type should be replaced with the actual HTTP code, for example http_error_404() would handle HTTP 404 errors.

Syntax

PYTHON
OpenerDirector.add_handler(handler)

See Also

BaseHandler BaseHandler.<protocol>_open() BaseHandler.http_error_<nnn>() BaseHandler.<protocol>_request() BaseHandler.<protocol>_response()