internet.md
1> **Источник:** https://python-all.ru/3.5/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.5/library/socket.html#module-socket), который в настоящее время поддерживается на большинстве популярных платформ. Вот обзор:1011- [21.1. `webbrowser` – Удобный контроллер веб-браузера](https://python-all.ru/3.5/library/webbrowser.html)1213 - [21.1.1. Объекты контроллера браузера](https://python-all.ru/3.5/library/webbrowser.html#browser-controller-objects)14- [21.2. `cgi` – Поддержка общего шлюзового интерфейса (CGI)](https://python-all.ru/3.5/library/cgi.html)1516 - [21.2.1. Введение](https://python-all.ru/3.5/library/cgi.html#introduction)17 - [21.2.2. Использование модуля cgi](https://python-all.ru/3.5/library/cgi.html#using-the-cgi-module)18 - [21.2.3. Интерфейс более высокого уровня](https://python-all.ru/3.5/library/cgi.html#higher-level-interface)19 - [21.2.4. Функции](https://python-all.ru/3.5/library/cgi.html#functions)20 - [21.2.5. Вопросы безопасности](https://python-all.ru/3.5/library/cgi.html#caring-about-security)21 - [21.2.6. Установка CGI-сценария в системе Unix](https://python-all.ru/3.5/library/cgi.html#installing-your-cgi-script-on-a-unix-system)22 - [21.2.7. Тестирование CGI-сценария](https://python-all.ru/3.5/library/cgi.html#testing-your-cgi-script)23 - [21.2.8. Отладка CGI-сценариев](https://python-all.ru/3.5/library/cgi.html#debugging-cgi-scripts)24 - [21.2.9. Типичные проблемы и их решения](https://python-all.ru/3.5/library/cgi.html#common-problems-and-solutions)25- [21.3. `cgitb` – менеджер трассировки для CGI-сценариев](https://python-all.ru/3.5/library/cgitb.html)26- [21.4. `wsgiref` – утилиты WSGI и эталонная реализация](https://python-all.ru/3.5/library/wsgiref.html)2728 - [21.4.1. `wsgiref.util` – утилиты окружения WSGI](https://python-all.ru/3.5/library/wsgiref.html#module-wsgiref.util)29 - [21.4.2. `wsgiref.headers` – инструменты для заголовков ответов WSGI](https://python-all.ru/3.5/library/wsgiref.html#module-wsgiref.headers)30 - [21.4.3. `wsgiref.simple_server` – простой HTTP-сервер WSGI](https://python-all.ru/3.5/library/wsgiref.html#module-wsgiref.simple_server)31 - [21.4.4. `wsgiref.validate` – проверка соответствия WSGI](https://python-all.ru/3.5/library/wsgiref.html#module-wsgiref.validate)32 - [21.4.5. `wsgiref.handlers` – базовые классы сервера и шлюза](https://python-all.ru/3.5/library/wsgiref.html#module-wsgiref.handlers)33 - [21.4.6. Примеры](https://python-all.ru/3.5/library/wsgiref.html#examples)34- [21.5. `urllib` – модули для работы с URL](https://python-all.ru/3.5/library/urllib.html)35- [21.6. `urllib.request` – расширяемая библиотека для открытия URL](https://python-all.ru/3.5/library/urllib.request.html)3637 - [21.6.1. Объекты Request](https://python-all.ru/3.5/library/urllib.request.html#request-objects)38 - [21.6.2. Объекты OpenerDirector](https://python-all.ru/3.5/library/urllib.request.html#openerdirector-objects)39 - [21.6.3. Объекты BaseHandler](https://python-all.ru/3.5/library/urllib.request.html#basehandler-objects)40 - [21.6.4. Объекты HTTPRedirectHandler](https://python-all.ru/3.5/library/urllib.request.html#httpredirecthandler-objects)41 - [21.6.5. Объекты HTTPCookieProcessor](https://python-all.ru/3.5/library/urllib.request.html#httpcookieprocessor-objects)42 - [21.6.6. Объекты ProxyHandler](https://python-all.ru/3.5/library/urllib.request.html#proxyhandler-objects)43 - [21.6.7. Объекты HTTPPasswordMgr](https://python-all.ru/3.5/library/urllib.request.html#httppasswordmgr-objects)44 - [21.6.8. Объекты HTTPPasswordMgrWithPriorAuth](https://python-all.ru/3.5/library/urllib.request.html#httppasswordmgrwithpriorauth-objects)45 - [21.6.9. Объекты AbstractBasicAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#abstractbasicauthhandler-objects)46 - [21.6.10. Объекты HTTPBasicAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#httpbasicauthhandler-objects)47 - [21.6.11. Объекты ProxyBasicAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#proxybasicauthhandler-objects)48 - [21.6.12. Объекты AbstractDigestAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#abstractdigestauthhandler-objects)49 - [21.6.13. Объекты HTTPDigestAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#httpdigestauthhandler-objects)50 - [21.6.14. Объекты ProxyDigestAuthHandler](https://python-all.ru/3.5/library/urllib.request.html#proxydigestauthhandler-objects)51 - [21.6.15. Объекты HTTPHandler](https://python-all.ru/3.5/library/urllib.request.html#httphandler-objects)52 - [21.6.16. Объекты HTTPSHandler](https://python-all.ru/3.5/library/urllib.request.html#httpshandler-objects)53 - [21.6.17. Объекты FileHandler](https://python-all.ru/3.5/library/urllib.request.html#filehandler-objects)54 - [21.6.18. Объекты DataHandler](https://python-all.ru/3.5/library/urllib.request.html#datahandler-objects)55 - [21.6.19. Объекты FTPHandler](https://python-all.ru/3.5/library/urllib.request.html#ftphandler-objects)56 - [21.6.20. Объекты CacheFTPHandler](https://python-all.ru/3.5/library/urllib.request.html#cacheftphandler-objects)57 - [21.6.21. Объекты UnknownHandler](https://python-all.ru/3.5/library/urllib.request.html#unknownhandler-objects)58 - [21.6.22. Объекты HTTPErrorProcessor](https://python-all.ru/3.5/library/urllib.request.html#httperrorprocessor-objects)59 - [21.6.23. Примеры](https://python-all.ru/3.5/library/urllib.request.html#examples)60 - [21.6.24. Устаревший интерфейс](https://python-all.ru/3.5/library/urllib.request.html#legacy-interface)61 - [21.6.25. `urllib.request` Ограничения](https://python-all.ru/3.5/library/urllib.request.html#urllib-request-restrictions)62- [21.7. `urllib.response` – Классы ответов, используемые urllib](https://python-all.ru/3.5/library/urllib.request.html#module-urllib.response)63- [21.8. `urllib.parse` – Разбор URL на компоненты](https://python-all.ru/3.5/library/urllib.parse.html)6465 - [21.8.1. Разбор URL](https://python-all.ru/3.5/library/urllib.parse.html#url-parsing)66 - [21.8.2. Разбор ASCII-кодированных байт](https://python-all.ru/3.5/library/urllib.parse.html#parsing-ascii-encoded-bytes)67 - [21.8.3. Структурированные результаты разбора](https://python-all.ru/3.5/library/urllib.parse.html#structured-parse-results)68 - [21.8.4. Квотирование URL](https://python-all.ru/3.5/library/urllib.parse.html#url-quoting)69- [21.9. `urllib.error` – Классы исключений, вызываемые urllib.request](https://python-all.ru/3.5/library/urllib.error.html)70- [21.10. `urllib.robotparser` – Парсер для robots.txt](https://python-all.ru/3.5/library/urllib.robotparser.html)71- [21.11. `http` – Модули HTTP](https://python-all.ru/3.5/library/http.html)7273 - [21.11.1. Коды состояния HTTP](https://python-all.ru/3.5/library/http.html#http-status-codes)74- [21.12. `http.client` – Клиент протокола HTTP](https://python-all.ru/3.5/library/http.client.html)7576 - [21.12.1. Объекты HTTPConnection](https://python-all.ru/3.5/library/http.client.html#httpconnection-objects)77 - [21.12.2. Объекты HTTPResponse](https://python-all.ru/3.5/library/http.client.html#httpresponse-objects)78 - [21.12.3. Примеры](https://python-all.ru/3.5/library/http.client.html#examples)79 - [21.12.4. Объекты HTTPMessage](https://python-all.ru/3.5/library/http.client.html#httpmessage-objects)80- [21.13. `ftplib` – Клиент протокола FTP](https://python-all.ru/3.5/library/ftplib.html)8182 - [21.13.1. Объекты FTP](https://python-all.ru/3.5/library/ftplib.html#ftp-objects)83 - [21.13.2. Объекты FTP\_TLS](https://python-all.ru/3.5/library/ftplib.html#ftp-tls-objects)84- [21.14. `poplib` – Клиент протокола POP3](https://python-all.ru/3.5/library/poplib.html)8586 - [21.14.1. Объекты POP3](https://python-all.ru/3.5/library/poplib.html#pop3-objects)87 - [21.14.2. Пример POP3](https://python-all.ru/3.5/library/poplib.html#pop3-example)88- [21.15. `imaplib` – Клиент протокола IMAP4](https://python-all.ru/3.5/library/imaplib.html)8990 - [21.15.1. Объекты IMAP4](https://python-all.ru/3.5/library/imaplib.html#imap4-objects)91 - [21.15.2. Пример IMAP4](https://python-all.ru/3.5/library/imaplib.html#imap4-example)92- [21.16. `nntplib` – клиент протокола NNTP](https://python-all.ru/3.5/library/nntplib.html)9394 - [21.16.1. Объекты NNTP](https://python-all.ru/3.5/library/nntplib.html#nntp-objects)9596 - [21.16.1.1. Атрибуты](https://python-all.ru/3.5/library/nntplib.html#attributes)97 - [21.16.1.2. Методы](https://python-all.ru/3.5/library/nntplib.html#methods)98 - [21.16.2. Вспомогательные функции](https://python-all.ru/3.5/library/nntplib.html#utility-functions)99- [21.17. `smtplib` – клиент протокола SMTP](https://python-all.ru/3.5/library/smtplib.html)100101 - [21.17.1. Объекты SMTP](https://python-all.ru/3.5/library/smtplib.html#smtp-objects)102 - [21.17.2. Пример SMTP](https://python-all.ru/3.5/library/smtplib.html#smtp-example)103- [21.18. `smtpd` – SMTP-сервер](https://python-all.ru/3.5/library/smtpd.html)104105 - [21.18.1. Объекты SMTPServer](https://python-all.ru/3.5/library/smtpd.html#smtpserver-objects)106 - [21.18.2. Объекты DebuggingServer](https://python-all.ru/3.5/library/smtpd.html#debuggingserver-objects)107 - [21.18.3. Объекты PureProxy](https://python-all.ru/3.5/library/smtpd.html#pureproxy-objects)108 - [21.18.4. Объекты MailmanProxy](https://python-all.ru/3.5/library/smtpd.html#mailmanproxy-objects)109 - [21.18.5. Объекты SMTPChannel](https://python-all.ru/3.5/library/smtpd.html#smtpchannel-objects)110- [21.19. `telnetlib` – Telnet-клиент](https://python-all.ru/3.5/library/telnetlib.html)111112 - [21.19.1. Объекты Telnet](https://python-all.ru/3.5/library/telnetlib.html#telnet-objects)113 - [21.19.2. Пример Telnet](https://python-all.ru/3.5/library/telnetlib.html#telnet-example)114- [21.20. `uuid` – Объекты UUID по RFC 4122](https://python-all.ru/3.5/library/uuid.html)115116 - [21.20.1. Пример](https://python-all.ru/3.5/library/uuid.html#example)117- [21.21. `socketserver` – фреймворк для сетевых серверов](https://python-all.ru/3.5/library/socketserver.html)118119 - [21.21.1. Примечания по созданию сервера](https://python-all.ru/3.5/library/socketserver.html#server-creation-notes)120 - [21.21.2. Объекты сервера](https://python-all.ru/3.5/library/socketserver.html#server-objects)121 - [21.21.3. Объекты обработчика запросов](https://python-all.ru/3.5/library/socketserver.html#request-handler-objects)122 - [21.21.4. Примеры](https://python-all.ru/3.5/library/socketserver.html#examples)123124 - [21.21.4.1. `socketserver.TCPServer` Пример](https://python-all.ru/3.5/library/socketserver.html#socketserver-tcpserver-example)125 - [21.21.4.2. `socketserver.UDPServer` Пример](https://python-all.ru/3.5/library/socketserver.html#socketserver-udpserver-example)126 - [21.21.4.3. Асинхронные миксины](https://python-all.ru/3.5/library/socketserver.html#asynchronous-mixins)127- [21.22. `http.server` – HTTP-серверы](https://python-all.ru/3.5/library/http.server.html)128- [21.23. `http.cookies` – управление состоянием HTTP](https://python-all.ru/3.5/library/http.cookies.html)129130 - [21.23.1. Объекты Cookie](https://python-all.ru/3.5/library/http.cookies.html#cookie-objects)131 - [21.23.2. Объекты Morsel](https://python-all.ru/3.5/library/http.cookies.html#morsel-objects)132 - [21.23.3. Пример](https://python-all.ru/3.5/library/http.cookies.html#example)133- [21.24. `http.cookiejar` – Обработка cookie для HTTP-клиентов](https://python-all.ru/3.5/library/http.cookiejar.html)134135 - [21.24.1. Объекты CookieJar и FileCookieJar](https://python-all.ru/3.5/library/http.cookiejar.html#cookiejar-and-filecookiejar-objects)136 - [21.24.2. Подклассы FileCookieJar и взаимодействие с веб-браузерами](https://python-all.ru/3.5/library/http.cookiejar.html#filecookiejar-subclasses-and-co-operation-with-web-browsers)137 - [21.24.3. Объекты CookiePolicy](https://python-all.ru/3.5/library/http.cookiejar.html#cookiepolicy-objects)138 - [21.24.4. Объекты DefaultCookiePolicy](https://python-all.ru/3.5/library/http.cookiejar.html#defaultcookiepolicy-objects)139 - [21.24.5. Объекты Cookie](https://python-all.ru/3.5/library/http.cookiejar.html#cookie-objects)140 - [21.24.6. Примеры](https://python-all.ru/3.5/library/http.cookiejar.html#examples)141- [21.25. `xmlrpc` – Модули сервера и клиента XML-RPC](https://python-all.ru/3.5/library/xmlrpc.html)142- [21.26. `xmlrpc.client` – Доступ клиента XML-RPC](https://python-all.ru/3.5/library/xmlrpc.client.html)143144 - [21.26.1. Объекты ServerProxy](https://python-all.ru/3.5/library/xmlrpc.client.html#serverproxy-objects)145 - [21.26.2. Объекты DateTime](https://python-all.ru/3.5/library/xmlrpc.client.html#datetime-objects)146 - [21.26.3. Объекты Binary](https://python-all.ru/3.5/library/xmlrpc.client.html#binary-objects)147 - [21.26.4. Объекты Fault](https://python-all.ru/3.5/library/xmlrpc.client.html#fault-objects)148 - [21.26.5. Объекты ProtocolError](https://python-all.ru/3.5/library/xmlrpc.client.html#protocolerror-objects)149 - [21.26.6. Объекты MultiCall](https://python-all.ru/3.5/library/xmlrpc.client.html#multicall-objects)150 - [21.26.7. Вспомогательные функции](https://python-all.ru/3.5/library/xmlrpc.client.html#convenience-functions)151 - [21.26.8. Пример использования клиента](https://python-all.ru/3.5/library/xmlrpc.client.html#example-of-client-usage)152 - [21.26.9. Пример использования клиента и сервера](https://python-all.ru/3.5/library/xmlrpc.client.html#example-of-client-and-server-usage)153- [21.27. `xmlrpc.server` – Базовые серверы XML-RPC](https://python-all.ru/3.5/library/xmlrpc.server.html)154155 - [21.27.1. Объекты SimpleXMLRPCServer](https://python-all.ru/3.5/library/xmlrpc.server.html#simplexmlrpcserver-objects)156157 - [21.27.1.1. Пример SimpleXMLRPCServer](https://python-all.ru/3.5/library/xmlrpc.server.html#simplexmlrpcserver-example)158 - [21.27.2. CGIXMLRPCRequestHandler](https://python-all.ru/3.5/library/xmlrpc.server.html#cgixmlrpcrequesthandler)159 - [21.27.3. Документирование сервера XMLRPC](https://python-all.ru/3.5/library/xmlrpc.server.html#documenting-xmlrpc-server)160 - [21.27.4. Объекты DocXMLRPCServer](https://python-all.ru/3.5/library/xmlrpc.server.html#docxmlrpcserver-objects)161 - [21.27.5. DocCGIXMLRPCRequestHandler](https://python-all.ru/3.5/library/xmlrpc.server.html#doccgixmlrpcrequesthandler)162- [21.28. `ipaddress` – Библиотека для работы с IPv4/IPv6](https://python-all.ru/3.5/library/ipaddress.html)163164 - [21.28.1. Вспомогательные фабричные функции](https://python-all.ru/3.5/library/ipaddress.html#convenience-factory-functions)165 - [21.28.2. IP-адреса](https://python-all.ru/3.5/library/ipaddress.html#ip-addresses)166167 - [21.28.2.1. Объекты адресов](https://python-all.ru/3.5/library/ipaddress.html#address-objects)168 - [21.28.2.2. Преобразование в строки и целые числа](https://python-all.ru/3.5/library/ipaddress.html#conversion-to-strings-and-integers)169 - [21.28.2.3. Операторы](https://python-all.ru/3.5/library/ipaddress.html#operators)170171 - [21.28.2.3.1. Операторы сравнения](https://python-all.ru/3.5/library/ipaddress.html#comparison-operators)172 - [21.28.2.3.2. Арифметические операторы](https://python-all.ru/3.5/library/ipaddress.html#arithmetic-operators)173 - [21.28.3. Определения IP-сети](https://python-all.ru/3.5/library/ipaddress.html#ip-network-definitions)174175 - [21.28.3.1. Префикс, маска сети и маска узла](https://python-all.ru/3.5/library/ipaddress.html#prefix-net-mask-and-host-mask)176 - [21.28.3.2. Сетевые объекты](https://python-all.ru/3.5/library/ipaddress.html#network-objects)177 - [21.28.3.3. Операторы](https://python-all.ru/3.5/library/ipaddress.html#id1)178179 - [21.28.3.3.1. Логические операторы](https://python-all.ru/3.5/library/ipaddress.html#logical-operators)180 - [21.28.3.3.2. Итерация](https://python-all.ru/3.5/library/ipaddress.html#iteration)181 - [21.28.3.3.3. Сети как контейнеры адресов](https://python-all.ru/3.5/library/ipaddress.html#networks-as-containers-of-addresses)182 - [21.28.4. Объекты интерфейса](https://python-all.ru/3.5/library/ipaddress.html#interface-objects)183 - [21.28.5. Прочие функции уровня модуля](https://python-all.ru/3.5/library/ipaddress.html#other-module-level-functions)184 - [21.28.6. Пользовательские исключения](https://python-all.ru/3.5/library/ipaddress.html#custom-exceptions)185