Документация Python неофициальный перевод

internet.md

181 строк · 18.4 КБ · обычная страница · сырой текст · скачать

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