internet.md
1> **Источник:** https://python-all.ru/3.4/library/internet.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# 21. Интернет-протоколы и поддержка89Модули, описанные в этой главе, реализуют интернет-протоколы и поддержку смежных технологий. Все они реализованы на Python. Большинство этих модулей требуют наличия системно-зависимого модуля [`socket`](https://python-all.ru/3.4/library/socket.html#module-socket), который в настоящее время поддерживается на большинстве популярных платформ. Здесь представлен обзор:1011- [21.1. `webbrowser` – Удобный контроллер веб-браузера](https://python-all.ru/3.4/library/webbrowser.html)1213 - [21.1.1. Объекты контроллера браузера](https://python-all.ru/3.4/library/webbrowser.html#browser-controller-objects)14- [21.2. `cgi` – Поддержка общего шлюзового интерфейса (CGI)](https://python-all.ru/3.4/library/cgi.html)1516 - [21.2.1. Введение](https://python-all.ru/3.4/library/cgi.html#introduction)17 - [21.2.2. Использование модуля cgi](https://python-all.ru/3.4/library/cgi.html#using-the-cgi-module)18 - [21.2.3. Интерфейс более высокого уровня](https://python-all.ru/3.4/library/cgi.html#higher-level-interface)19 - [21.2.4. Функции](https://python-all.ru/3.4/library/cgi.html#functions)20 - [21.2.5. Вопросы безопасности](https://python-all.ru/3.4/library/cgi.html#caring-about-security)21 - [21.2.6. Установка CGI-сценария в системе Unix](https://python-all.ru/3.4/library/cgi.html#installing-your-cgi-script-on-a-unix-system)22 - [21.2.7. Тестирование CGI-сценария](https://python-all.ru/3.4/library/cgi.html#testing-your-cgi-script)23 - [21.2.8. Отладка CGI-сценариев](https://python-all.ru/3.4/library/cgi.html#debugging-cgi-scripts)24 - [21.2.9. Типичные проблемы и их решения](https://python-all.ru/3.4/library/cgi.html#common-problems-and-solutions)25- [21.3. `cgitb` – Менеджер трассировки для CGI-скриптов](https://python-all.ru/3.4/library/cgitb.html)26- [21.4. `wsgiref` – Утилиты и эталонная реализация WSGI](https://python-all.ru/3.4/library/wsgiref.html)2728 - [21.4.1. `wsgiref.util` – Утилиты окружения WSGI](https://python-all.ru/3.4/library/wsgiref.html#module-wsgiref.util)29 - [21.4.2. `wsgiref.headers` – Инструменты для заголовков ответов WSGI](https://python-all.ru/3.4/library/wsgiref.html#module-wsgiref.headers)30 - [21.4.3. `wsgiref.simple_server` – Простой HTTP-сервер WSGI](https://python-all.ru/3.4/library/wsgiref.html#module-wsgiref.simple_server)31 - [21.4.4. `wsgiref.validate` – Проверка соответствия WSGI](https://python-all.ru/3.4/library/wsgiref.html#module-wsgiref.validate)32 - [21.4.5. `wsgiref.handlers` – Базовые классы сервера и шлюза](https://python-all.ru/3.4/library/wsgiref.html#module-wsgiref.handlers)33 - [21.4.6. Примеры](https://python-all.ru/3.4/library/wsgiref.html#examples)34- [21.5. `urllib` – Модули для работы с URL](https://python-all.ru/3.4/library/urllib.html)35- [21.6. `urllib.request` – Расширяемая библиотека для открытия URL](https://python-all.ru/3.4/library/urllib.request.html)3637 - [21.6.1. Объекты Request](https://python-all.ru/3.4/library/urllib.request.html#request-objects)38 - [21.6.2. Объекты OpenerDirector](https://python-all.ru/3.4/library/urllib.request.html#openerdirector-objects)39 - [21.6.3. Объекты BaseHandler](https://python-all.ru/3.4/library/urllib.request.html#basehandler-objects)40 - [21.6.4. Объекты HTTPRedirectHandler](https://python-all.ru/3.4/library/urllib.request.html#httpredirecthandler-objects)41 - [21.6.5. Объекты HTTPCookieProcessor](https://python-all.ru/3.4/library/urllib.request.html#httpcookieprocessor-objects)42 - [21.6.6. Объекты ProxyHandler](https://python-all.ru/3.4/library/urllib.request.html#proxyhandler-objects)43 - [21.6.7. Объекты HTTPPasswordMgr](https://python-all.ru/3.4/library/urllib.request.html#httppasswordmgr-objects)44 - [21.6.8. Объекты AbstractBasicAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#abstractbasicauthhandler-objects)45 - [21.6.9. Объекты HTTPBasicAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#httpbasicauthhandler-objects)46 - [21.6.10. Объекты ProxyBasicAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#proxybasicauthhandler-objects)47 - [21.6.11. Объекты AbstractDigestAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#abstractdigestauthhandler-objects)48 - [21.6.12. Объекты HTTPDigestAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#httpdigestauthhandler-objects)49 - [21.6.13. Объекты ProxyDigestAuthHandler](https://python-all.ru/3.4/library/urllib.request.html#proxydigestauthhandler-objects)50 - [21.6.14. Объекты HTTPHandler](https://python-all.ru/3.4/library/urllib.request.html#httphandler-objects)51 - [21.6.15. Объекты HTTPSHandler](https://python-all.ru/3.4/library/urllib.request.html#httpshandler-objects)52 - [21.6.16. Объекты FileHandler](https://python-all.ru/3.4/library/urllib.request.html#filehandler-objects)53 - [21.6.17. Объекты DataHandler](https://python-all.ru/3.4/library/urllib.request.html#datahandler-objects)54 - [21.6.18. Объекты FTPHandler](https://python-all.ru/3.4/library/urllib.request.html#ftphandler-objects)55 - [21.6.19. Объекты CacheFTPHandler](https://python-all.ru/3.4/library/urllib.request.html#cacheftphandler-objects)56 - [21.6.20. Объекты UnknownHandler](https://python-all.ru/3.4/library/urllib.request.html#unknownhandler-objects)57 - [21.6.21. Объекты HTTPErrorProcessor](https://python-all.ru/3.4/library/urllib.request.html#httperrorprocessor-objects)58 - [21.6.22. Примеры](https://python-all.ru/3.4/library/urllib.request.html#examples)59 - [21.6.23. Устаревший интерфейс](https://python-all.ru/3.4/library/urllib.request.html#legacy-interface)60 - [21.6.24. `urllib.request` Ограничения](https://python-all.ru/3.4/library/urllib.request.html#urllib-request-restrictions)61- [21.7. `urllib.response` – Классы ответов, используемые urllib](https://python-all.ru/3.4/library/urllib.request.html#module-urllib.response)62- [21.8. `urllib.parse` – Разбор URL на составные части](https://python-all.ru/3.4/library/urllib.parse.html)6364 - [21.8.1. Разбор URL](https://python-all.ru/3.4/library/urllib.parse.html#url-parsing)65 - [21.8.2. Разбор ASCII-кодированных байт](https://python-all.ru/3.4/library/urllib.parse.html#parsing-ascii-encoded-bytes)66 - [21.8.3. Структурированные результаты разбора](https://python-all.ru/3.4/library/urllib.parse.html#structured-parse-results)67 - [21.8.4. Квотирование URL](https://python-all.ru/3.4/library/urllib.parse.html#url-quoting)68- [21.9. `urllib.error` – Классы исключений, вызываемые urllib.request](https://python-all.ru/3.4/library/urllib.error.html)69- [21.10. `urllib.robotparser` – Парсер robots.txt](https://python-all.ru/3.4/library/urllib.robotparser.html)70- [21.11. `http` – Модули HTTP](https://python-all.ru/3.4/library/http.html)71- [21.12. `http.client` – Клиент протокола HTTP](https://python-all.ru/3.4/library/http.client.html)7273 - [21.12.1. Объекты HTTPConnection](https://python-all.ru/3.4/library/http.client.html#httpconnection-objects)74 - [21.12.2. Объекты HTTPResponse](https://python-all.ru/3.4/library/http.client.html#httpresponse-objects)75 - [21.12.3. Примеры](https://python-all.ru/3.4/library/http.client.html#examples)76 - [21.12.4. Объекты HTTPMessage](https://python-all.ru/3.4/library/http.client.html#httpmessage-objects)77- [21.13. `ftplib` – клиент протокола FTP](https://python-all.ru/3.4/library/ftplib.html)7879 - [21.13.1. Объекты FTP](https://python-all.ru/3.4/library/ftplib.html#ftp-objects)80 - [21.13.2. Объекты FTP\_TLS](https://python-all.ru/3.4/library/ftplib.html#ftp-tls-objects)81- [21.14. `poplib` – клиент протокола POP3](https://python-all.ru/3.4/library/poplib.html)8283 - [21.14.1. Объекты POP3](https://python-all.ru/3.4/library/poplib.html#pop3-objects)84 - [21.14.2. Пример POP3](https://python-all.ru/3.4/library/poplib.html#pop3-example)85- [21.15. `imaplib` – клиент протокола IMAP4](https://python-all.ru/3.4/library/imaplib.html)8687 - [21.15.1. Объекты IMAP4](https://python-all.ru/3.4/library/imaplib.html#imap4-objects)88 - [21.15.2. Пример IMAP4](https://python-all.ru/3.4/library/imaplib.html#imap4-example)89- [21.16. `nntplib` – клиент протокола NNTP](https://python-all.ru/3.4/library/nntplib.html)9091 - [21.16.1. Объекты NNTP](https://python-all.ru/3.4/library/nntplib.html#nntp-objects)9293 - [21.16.1.1. Атрибуты](https://python-all.ru/3.4/library/nntplib.html#attributes)94 - [21.16.1.2. Методы](https://python-all.ru/3.4/library/nntplib.html#methods)95 - [21.16.2. Вспомогательные функции](https://python-all.ru/3.4/library/nntplib.html#utility-functions)96- [21.17. `smtplib` – клиент протокола SMTP](https://python-all.ru/3.4/library/smtplib.html)9798 - [21.17.1. Объекты SMTP](https://python-all.ru/3.4/library/smtplib.html#smtp-objects)99 - [21.17.2. Пример SMTP](https://python-all.ru/3.4/library/smtplib.html#smtp-example)100- [21.18. `smtpd` – SMTP-сервер](https://python-all.ru/3.4/library/smtpd.html)101102 - [21.18.1. Объекты SMTPServer](https://python-all.ru/3.4/library/smtpd.html#smtpserver-objects)103 - [21.18.2. Объекты DebuggingServer](https://python-all.ru/3.4/library/smtpd.html#debuggingserver-objects)104 - [21.18.3. Объекты PureProxy](https://python-all.ru/3.4/library/smtpd.html#pureproxy-objects)105 - [21.18.4. Объекты MailmanProxy](https://python-all.ru/3.4/library/smtpd.html#mailmanproxy-objects)106 - [21.18.5. Объекты SMTPChannel](https://python-all.ru/3.4/library/smtpd.html#smtpchannel-objects)107- [21.19. `telnetlib` – Telnet-клиент](https://python-all.ru/3.4/library/telnetlib.html)108109 - [21.19.1. Объекты Telnet](https://python-all.ru/3.4/library/telnetlib.html#telnet-objects)110 - [21.19.2. Пример Telnet](https://python-all.ru/3.4/library/telnetlib.html#telnet-example)111- [21.20. `uuid` – объекты UUID в соответствии с RFC 4122](https://python-all.ru/3.4/library/uuid.html)112113 - [21.20.1. Пример](https://python-all.ru/3.4/library/uuid.html#example)114- [21.21. `socketserver` – фреймворк для сетевых серверов](https://python-all.ru/3.4/library/socketserver.html)115116 - [21.21.1. Примечания по созданию сервера](https://python-all.ru/3.4/library/socketserver.html#server-creation-notes)117 - [21.21.2. Объекты сервера](https://python-all.ru/3.4/library/socketserver.html#server-objects)118 - [21.21.3. Объекты RequestHandler](https://python-all.ru/3.4/library/socketserver.html#requesthandler-objects)119 - [21.21.4. Примеры](https://python-all.ru/3.4/library/socketserver.html#examples)120121 - [21.21.4.1. Пример `socketserver.TCPServer`](https://python-all.ru/3.4/library/socketserver.html#socketserver-tcpserver-example)122 - [21.21.4.2. Пример `socketserver.UDPServer`](https://python-all.ru/3.4/library/socketserver.html#socketserver-udpserver-example)123 - [21.21.4.3. Асинхронные миксины](https://python-all.ru/3.4/library/socketserver.html#asynchronous-mixins)124- [21.22. `http.server` – HTTP-серверы](https://python-all.ru/3.4/library/http.server.html)125- [21.23. `http.cookies` – управление состоянием HTTP](https://python-all.ru/3.4/library/http.cookies.html)126127 - [21.23.1. Объекты Cookie](https://python-all.ru/3.4/library/http.cookies.html#cookie-objects)128 - [21.23.2. Объекты Morsel](https://python-all.ru/3.4/library/http.cookies.html#morsel-objects)129 - [21.23.3. Пример](https://python-all.ru/3.4/library/http.cookies.html#example)130- [21.24. `http.cookiejar` – обработка cookie для HTTP-клиентов](https://python-all.ru/3.4/library/http.cookiejar.html)131132 - [21.24.1. Объекты CookieJar и FileCookieJar](https://python-all.ru/3.4/library/http.cookiejar.html#cookiejar-and-filecookiejar-objects)133 - [21.24.2. Подклассы FileCookieJar и взаимодействие с веб-браузерами](https://python-all.ru/3.4/library/http.cookiejar.html#filecookiejar-subclasses-and-co-operation-with-web-browsers)134 - [21.24.3. Объекты CookiePolicy](https://python-all.ru/3.4/library/http.cookiejar.html#cookiepolicy-objects)135 - [21.24.4. Объекты DefaultCookiePolicy](https://python-all.ru/3.4/library/http.cookiejar.html#defaultcookiepolicy-objects)136 - [21.24.5. Объекты Cookie](https://python-all.ru/3.4/library/http.cookiejar.html#cookie-objects)137 - [21.24.6. Примеры](https://python-all.ru/3.4/library/http.cookiejar.html#examples)138- [21.25. `xmlrpc` – модули сервера и клиента XML-RPC](https://python-all.ru/3.4/library/xmlrpc.html)139- [21.26. `xmlrpc.client` – клиентский доступ к XML-RPC](https://python-all.ru/3.4/library/xmlrpc.client.html)140141 - [21.26.1. Объекты ServerProxy](https://python-all.ru/3.4/library/xmlrpc.client.html#serverproxy-objects)142 - [21.26.2. Объекты DateTime](https://python-all.ru/3.4/library/xmlrpc.client.html#datetime-objects)143 - [21.26.3. Объекты Binary](https://python-all.ru/3.4/library/xmlrpc.client.html#binary-objects)144 - [21.26.4. Объекты Fault](https://python-all.ru/3.4/library/xmlrpc.client.html#fault-objects)145 - [21.26.5. Объекты ProtocolError](https://python-all.ru/3.4/library/xmlrpc.client.html#protocolerror-objects)146 - [21.26.6. Объекты MultiCall](https://python-all.ru/3.4/library/xmlrpc.client.html#multicall-objects)147 - [21.26.7. Вспомогательные функции](https://python-all.ru/3.4/library/xmlrpc.client.html#convenience-functions)148 - [21.26.8. Пример использования клиента](https://python-all.ru/3.4/library/xmlrpc.client.html#example-of-client-usage)149 - [21.26.9. Пример использования клиента и сервера](https://python-all.ru/3.4/library/xmlrpc.client.html#example-of-client-and-server-usage)150- [21.27. `xmlrpc.server` – базовые XML-RPC серверы](https://python-all.ru/3.4/library/xmlrpc.server.html)151152 - [21.27.1. Объекты SimpleXMLRPCServer](https://python-all.ru/3.4/library/xmlrpc.server.html#simplexmlrpcserver-objects)153154 - [21.27.1.1. Пример SimpleXMLRPCServer](https://python-all.ru/3.4/library/xmlrpc.server.html#simplexmlrpcserver-example)155 - [21.27.2. CGIXMLRPCRequestHandler](https://python-all.ru/3.4/library/xmlrpc.server.html#cgixmlrpcrequesthandler)156 - [21.27.3. Документирование сервера XMLRPC](https://python-all.ru/3.4/library/xmlrpc.server.html#documenting-xmlrpc-server)157 - [21.27.4. Объекты DocXMLRPCServer](https://python-all.ru/3.4/library/xmlrpc.server.html#docxmlrpcserver-objects)158 - [21.27.5. DocCGIXMLRPCRequestHandler](https://python-all.ru/3.4/library/xmlrpc.server.html#doccgixmlrpcrequesthandler)159- [21.28. `ipaddress` – библиотека для работы с IPv4/IPv6](https://python-all.ru/3.4/library/ipaddress.html)160161 - [21.28.1. Вспомогательные фабричные функции](https://python-all.ru/3.4/library/ipaddress.html#convenience-factory-functions)162 - [21.28.2. IP-адреса](https://python-all.ru/3.4/library/ipaddress.html#ip-addresses)163164 - [21.28.2.1. Объекты адресов](https://python-all.ru/3.4/library/ipaddress.html#address-objects)165 - [21.28.2.2. Преобразование в строки и целые числа](https://python-all.ru/3.4/library/ipaddress.html#conversion-to-strings-and-integers)166 - [21.28.2.3. Операторы](https://python-all.ru/3.4/library/ipaddress.html#operators)167168 - [21.28.2.3.1. Операторы сравнения](https://python-all.ru/3.4/library/ipaddress.html#comparison-operators)169 - [21.28.2.3.2. Арифметические операторы](https://python-all.ru/3.4/library/ipaddress.html#arithmetic-operators)170 - [21.28.3. Определения IP-сети](https://python-all.ru/3.4/library/ipaddress.html#ip-network-definitions)171172 - [21.28.3.1. Префикс, маска сети и маска узла](https://python-all.ru/3.4/library/ipaddress.html#prefix-net-mask-and-host-mask)173 - [21.28.3.2. Сетевые объекты](https://python-all.ru/3.4/library/ipaddress.html#network-objects)174 - [21.28.3.3. Операторы](https://python-all.ru/3.4/library/ipaddress.html#id1)175176 - [21.28.3.3.1. Логические операторы](https://python-all.ru/3.4/library/ipaddress.html#logical-operators)177 - [21.28.3.3.2. Итерация](https://python-all.ru/3.4/library/ipaddress.html#iteration)178 - [21.28.3.3.3. Сети как контейнеры адресов](https://python-all.ru/3.4/library/ipaddress.html#networks-as-containers-of-addresses)179 - [21.28.4. Объекты интерфейса](https://python-all.ru/3.4/library/ipaddress.html#interface-objects)180 - [21.28.5. Прочие функции уровня модуля](https://python-all.ru/3.4/library/ipaddress.html#other-module-level-functions)181 - [21.28.6. Пользовательские исключения](https://python-all.ru/3.4/library/ipaddress.html#custom-exceptions)182