> **Источник:** https://python-all.ru/2.7/library/internet.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# 20. Интернет-протоколы и поддержка

Модули, описанные в этой главе, реализуют интернет-протоколы и поддержку связанных технологий. Все они реализованы на Python. Большинству из этих модулей требуется наличие системно-зависимого модуля [`socket`](https://python-all.ru/2.7/library/socket.html#module-socket), который в настоящее время поддерживается на большинстве популярных платформ. Вот обзор:

- [20.1. `webbrowser` – Удобный контроллер веб-браузера](https://python-all.ru/2.7/library/webbrowser.html)

  - [20.1.1. Объекты контроллера браузера](https://python-all.ru/2.7/library/webbrowser.html#browser-controller-objects)
- [20.2. `cgi` – Поддержка Common Gateway Interface](https://python-all.ru/2.7/library/cgi.html)

  - [20.2.1. Введение](https://python-all.ru/2.7/library/cgi.html#introduction)
  - [20.2.2. Использование модуля cgi](https://python-all.ru/2.7/library/cgi.html#using-the-cgi-module)
  - [20.2.3. Интерфейс высокого уровня](https://python-all.ru/2.7/library/cgi.html#higher-level-interface)
  - [20.2.4. Устаревшие классы](https://python-all.ru/2.7/library/cgi.html#old-classes)
  - [20.2.5. Функции](https://python-all.ru/2.7/library/cgi.html#functions)
  - [20.2.6. Забота о безопасности](https://python-all.ru/2.7/library/cgi.html#caring-about-security)
  - [20.2.7. Установка CGI-скрипта в системе Unix](https://python-all.ru/2.7/library/cgi.html#installing-your-cgi-script-on-a-unix-system)
  - [20.2.8. Тестирование CGI-сценария](https://python-all.ru/2.7/library/cgi.html#testing-your-cgi-script)
  - [20.2.9. Отладка CGI-сценариев](https://python-all.ru/2.7/library/cgi.html#debugging-cgi-scripts)
  - [20.2.10. Типичные проблемы и их решения](https://python-all.ru/2.7/library/cgi.html#common-problems-and-solutions)
- [20.3. `cgitb` – Менеджер трассировки для CGI-сценариев](https://python-all.ru/2.7/library/cgitb.html)
- [20.4. `wsgiref` – Утилиты WSGI и эталонная реализация](https://python-all.ru/2.7/library/wsgiref.html)

  - [20.4.1. `wsgiref.util` – Утилиты окружения WSGI](https://python-all.ru/2.7/library/wsgiref.html#module-wsgiref.util)
  - [20.4.2. `wsgiref.headers` – Инструменты для заголовков ответов WSGI](https://python-all.ru/2.7/library/wsgiref.html#module-wsgiref.headers)
  - [20.4.3. `wsgiref.simple_server` – Простой HTTP-сервер WSGI](https://python-all.ru/2.7/library/wsgiref.html#module-wsgiref.simple_server)
  - [20.4.4. `wsgiref.validate` – Проверка соответствия WSGI](https://python-all.ru/2.7/library/wsgiref.html#module-wsgiref.validate)
  - [20.4.5. `wsgiref.handlers` – Базовые классы сервера/шлюза](https://python-all.ru/2.7/library/wsgiref.html#module-wsgiref.handlers)
  - [20.4.6. Примеры](https://python-all.ru/2.7/library/wsgiref.html#examples)
- [20.5. `urllib` – Открытие произвольных ресурсов по URL](https://python-all.ru/2.7/library/urllib.html)

  - [20.5.1. Интерфейс высокого уровня](https://python-all.ru/2.7/library/urllib.html#high-level-interface)
  - [20.5.2. Вспомогательные функции](https://python-all.ru/2.7/library/urllib.html#utility-functions)
  - [20.5.3. Объекты-открыватели URL](https://python-all.ru/2.7/library/urllib.html#url-opener-objects)
  - [20.5.4. `urllib` Ограничения](https://python-all.ru/2.7/library/urllib.html#urllib-restrictions)
  - [20.5.5. Примеры](https://python-all.ru/2.7/library/urllib.html#examples)
- [20.6. `urllib2` – Расширяемая библиотека для открытия URL](https://python-all.ru/2.7/library/urllib2.html)

  - [20.6.1. Объекты запроса](https://python-all.ru/2.7/library/urllib2.html#request-objects)
  - [20.6.2. Объекты OpenerDirector](https://python-all.ru/2.7/library/urllib2.html#openerdirector-objects)
  - [20.6.3. Объекты BaseHandler](https://python-all.ru/2.7/library/urllib2.html#basehandler-objects)
  - [20.6.4. Объекты HTTPRedirectHandler](https://python-all.ru/2.7/library/urllib2.html#httpredirecthandler-objects)
  - [20.6.5. Объекты HTTPCookieProcessor](https://python-all.ru/2.7/library/urllib2.html#httpcookieprocessor-objects)
  - [20.6.6. Объекты ProxyHandler](https://python-all.ru/2.7/library/urllib2.html#proxyhandler-objects)
  - [20.6.7. Объекты HTTPPasswordMgr](https://python-all.ru/2.7/library/urllib2.html#httppasswordmgr-objects)
  - [20.6.8. Объекты AbstractBasicAuthHandler](https://python-all.ru/2.7/library/urllib2.html#abstractbasicauthhandler-objects)
  - [20.6.9. Объекты HTTPBasicAuthHandler](https://python-all.ru/2.7/library/urllib2.html#httpbasicauthhandler-objects)
  - [20.6.10. Объекты ProxyBasicAuthHandler](https://python-all.ru/2.7/library/urllib2.html#proxybasicauthhandler-objects)
  - [20.6.11. Объекты AbstractDigestAuthHandler](https://python-all.ru/2.7/library/urllib2.html#abstractdigestauthhandler-objects)
  - [20.6.12. Объекты HTTPDigestAuthHandler](https://python-all.ru/2.7/library/urllib2.html#httpdigestauthhandler-objects)
  - [20.6.13. Объекты ProxyDigestAuthHandler](https://python-all.ru/2.7/library/urllib2.html#proxydigestauthhandler-objects)
  - [20.6.14. Объекты HTTPHandler](https://python-all.ru/2.7/library/urllib2.html#httphandler-objects)
  - [20.6.15. Объекты HTTPSHandler](https://python-all.ru/2.7/library/urllib2.html#httpshandler-objects)
  - [20.6.16. Объекты FileHandler](https://python-all.ru/2.7/library/urllib2.html#filehandler-objects)
  - [20.6.17. Объекты FTPHandler](https://python-all.ru/2.7/library/urllib2.html#ftphandler-objects)
  - [20.6.18. Объекты CacheFTPHandler](https://python-all.ru/2.7/library/urllib2.html#cacheftphandler-objects)
  - [20.6.19. Объекты UnknownHandler](https://python-all.ru/2.7/library/urllib2.html#unknownhandler-objects)
  - [20.6.20. Объекты HTTPErrorProcessor](https://python-all.ru/2.7/library/urllib2.html#httperrorprocessor-objects)
  - [20.6.21. Примеры](https://python-all.ru/2.7/library/urllib2.html#examples)
- [20.7. `httplib` – Клиент протокола HTTP](https://python-all.ru/2.7/library/httplib.html)

  - [20.7.1. Объекты HTTPConnection](https://python-all.ru/2.7/library/httplib.html#httpconnection-objects)
  - [20.7.2. Объекты HTTPResponse](https://python-all.ru/2.7/library/httplib.html#httpresponse-objects)
  - [20.7.3. Примеры](https://python-all.ru/2.7/library/httplib.html#examples)
- [20.8. `ftplib` – Клиент протокола FTP](https://python-all.ru/2.7/library/ftplib.html)

  - [20.8.1. Объекты FTP](https://python-all.ru/2.7/library/ftplib.html#ftp-objects)
  - [20.8.2. Объекты FTP\_TLS](https://python-all.ru/2.7/library/ftplib.html#ftp-tls-objects)
- [20.9. `poplib` – Клиент протокола POP3](https://python-all.ru/2.7/library/poplib.html)

  - [20.9.1. Объекты POP3](https://python-all.ru/2.7/library/poplib.html#pop3-objects)
  - [20.9.2. Пример POP3](https://python-all.ru/2.7/library/poplib.html#pop3-example)
- [20.10. `imaplib` – Клиент протокола IMAP4](https://python-all.ru/2.7/library/imaplib.html)

  - [20.10.1. Объекты IMAP4](https://python-all.ru/2.7/library/imaplib.html#imap4-objects)
  - [20.10.2. Пример IMAP4](https://python-all.ru/2.7/library/imaplib.html#imap4-example)
- [20.11. `nntplib` – Клиент протокола NNTP](https://python-all.ru/2.7/library/nntplib.html)

  - [20.11.1. Объекты NNTP](https://python-all.ru/2.7/library/nntplib.html#nntp-objects)
- [20.12. `smtplib` – Клиент протокола SMTP](https://python-all.ru/2.7/library/smtplib.html)

  - [20.12.1. Объекты SMTP](https://python-all.ru/2.7/library/smtplib.html#smtp-objects)
  - [20.12.2. Пример SMTP](https://python-all.ru/2.7/library/smtplib.html#smtp-example)
- [20.13. `smtpd` – Сервер SMTP](https://python-all.ru/2.7/library/smtpd.html)

  - [20.13.1. Объекты SMTPServer](https://python-all.ru/2.7/library/smtpd.html#smtpserver-objects)
  - [20.13.2. Объекты DebuggingServer](https://python-all.ru/2.7/library/smtpd.html#debuggingserver-objects)
  - [20.13.3. Объекты PureProxy](https://python-all.ru/2.7/library/smtpd.html#pureproxy-objects)
  - [20.13.4. Объекты MailmanProxy](https://python-all.ru/2.7/library/smtpd.html#mailmanproxy-objects)
- [20.14. `telnetlib` – Telnet-клиент](https://python-all.ru/2.7/library/telnetlib.html)

  - [20.14.1. Объекты Telnet](https://python-all.ru/2.7/library/telnetlib.html#telnet-objects)
  - [20.14.2. Пример Telnet](https://python-all.ru/2.7/library/telnetlib.html#telnet-example)
- [20.15. `uuid` – объекты UUID в соответствии с RFC 4122](https://python-all.ru/2.7/library/uuid.html)

  - [20.15.1. Пример](https://python-all.ru/2.7/library/uuid.html#example)
- [20.16. `urlparse` – разбор URL на компоненты](https://python-all.ru/2.7/library/urlparse.html)

  - [20.16.1. Результаты `urlparse()` и `urlsplit()`](https://python-all.ru/2.7/library/urlparse.html#results-of-urlparse-and-urlsplit)
- [20.17. `SocketServer` – каркас для сетевых серверов](https://python-all.ru/2.7/library/socketserver.html)

  - [20.17.1. Примечания по созданию сервера](https://python-all.ru/2.7/library/socketserver.html#server-creation-notes)
  - [20.17.2. Объекты сервера](https://python-all.ru/2.7/library/socketserver.html#server-objects)
  - [20.17.3. Объекты обработчика запросов](https://python-all.ru/2.7/library/socketserver.html#request-handler-objects)
  - [20.17.4. Примеры](https://python-all.ru/2.7/library/socketserver.html#examples)

    - [20.17.4.1. `SocketServer.TCPServer` Пример](https://python-all.ru/2.7/library/socketserver.html#socketserver-tcpserver-example)
    - [20.17.4.2. `SocketServer.UDPServer` Пример](https://python-all.ru/2.7/library/socketserver.html#socketserver-udpserver-example)
    - [20.17.4.3. Асинхронные примеси](https://python-all.ru/2.7/library/socketserver.html#asynchronous-mixins)
- [20.18. `BaseHTTPServer` – базовый HTTP-сервер](https://python-all.ru/2.7/library/basehttpserver.html)

  - [20.18.1. Дополнительные примеры](https://python-all.ru/2.7/library/basehttpserver.html#more-examples)
- [20.19. `SimpleHTTPServer` – простой обработчик HTTP-запросов](https://python-all.ru/2.7/library/simplehttpserver.html)
- [20.20. `CGIHTTPServer` – обработчик HTTP-запросов с поддержкой CGI](https://python-all.ru/2.7/library/cgihttpserver.html)
- [20.21. `cookielib` – управление cookie для HTTP-клиентов](https://python-all.ru/2.7/library/cookielib.html)

  - [20.21.1. Объекты CookieJar и FileCookieJar](https://python-all.ru/2.7/library/cookielib.html#cookiejar-and-filecookiejar-objects)
  - [20.21.2. Подклассы FileCookieJar и взаимодействие с веб-браузерами](https://python-all.ru/2.7/library/cookielib.html#filecookiejar-subclasses-and-co-operation-with-web-browsers)
  - [20.21.3. Объекты CookiePolicy](https://python-all.ru/2.7/library/cookielib.html#cookiepolicy-objects)
  - [20.21.4. Объекты DefaultCookiePolicy](https://python-all.ru/2.7/library/cookielib.html#defaultcookiepolicy-objects)
  - [20.21.5. Объекты Cookie](https://python-all.ru/2.7/library/cookielib.html#cookie-objects)
  - [20.21.6. Примеры](https://python-all.ru/2.7/library/cookielib.html#examples)
- [20.22. `Cookie` – управление состоянием HTTP](https://python-all.ru/2.7/library/cookie.html)

  - [20.22.1. Объекты Cookie](https://python-all.ru/2.7/library/cookie.html#cookie-objects)
  - [20.22.2. Объекты Morsel](https://python-all.ru/2.7/library/cookie.html#morsel-objects)
  - [20.22.3. Пример](https://python-all.ru/2.7/library/cookie.html#example)
- [20.23. `xmlrpclib` – клиентский доступ к XML-RPC](https://python-all.ru/2.7/library/xmlrpclib.html)

  - [20.23.1. Объекты ServerProxy](https://python-all.ru/2.7/library/xmlrpclib.html#serverproxy-objects)
  - [20.23.2. Объекты Boolean](https://python-all.ru/2.7/library/xmlrpclib.html#boolean-objects)
  - [20.23.3. Объекты DateTime](https://python-all.ru/2.7/library/xmlrpclib.html#datetime-objects)
  - [20.23.4. Объекты Binary](https://python-all.ru/2.7/library/xmlrpclib.html#binary-objects)
  - [20.23.5. Объекты Fault](https://python-all.ru/2.7/library/xmlrpclib.html#fault-objects)
  - [20.23.6. Объекты ProtocolError](https://python-all.ru/2.7/library/xmlrpclib.html#protocolerror-objects)
  - [20.23.7. Объекты MultiCall](https://python-all.ru/2.7/library/xmlrpclib.html#multicall-objects)
  - [20.23.8. Вспомогательные функции](https://python-all.ru/2.7/library/xmlrpclib.html#convenience-functions)
  - [20.23.9. Пример использования клиента](https://python-all.ru/2.7/library/xmlrpclib.html#example-of-client-usage)
  - [20.23.10. Пример использования клиента и сервера](https://python-all.ru/2.7/library/xmlrpclib.html#example-of-client-and-server-usage)
- [20.24. `SimpleXMLRPCServer` – Базовый сервер XML-RPC](https://python-all.ru/2.7/library/simplexmlrpcserver.html)

  - [20.24.1. Объекты SimpleXMLRPCServer](https://python-all.ru/2.7/library/simplexmlrpcserver.html#simplexmlrpcserver-objects)

    - [20.24.1.1. Пример SimpleXMLRPCServer](https://python-all.ru/2.7/library/simplexmlrpcserver.html#simplexmlrpcserver-example)
  - [20.24.2. CGIXMLRPCRequestHandler](https://python-all.ru/2.7/library/simplexmlrpcserver.html#cgixmlrpcrequesthandler)
- [20.25. `DocXMLRPCServer` – Самодокументирующийся сервер XML-RPC](https://python-all.ru/2.7/library/docxmlrpcserver.html)

  - [20.25.1. Объекты DocXMLRPCServer](https://python-all.ru/2.7/library/docxmlrpcserver.html#docxmlrpcserver-objects)
  - [20.25.2. DocCGIXMLRPCRequestHandler](https://python-all.ru/2.7/library/docxmlrpcserver.html#doccgixmlrpcrequesthandler)
