Python-network-programming-python-internet-protocol
提供:Dev Guides
Python-インターネットプロトコル
インターネットプロトコルは、インターネットに接続されたすべてのコンピューターでアドレスの統一システムを実装し、パケットがインターネットの一方の端からもう一方の端に移動できるように設計されています。 Webブラウザーのようなプログラムは、各パケットがどのパケットを移動するのか迷うことなく、どこにいてもホストに接続できる必要があります。 インターネットプロトコルにはさまざまなカテゴリがあります。 これらのプロトコルは、インターネット内の異なるコンピューター間の異なるタイプのデータ通信のニーズに応えるために作成されています。
Pythonには、これらの各通信シナリオを処理するためのいくつかのモジュールがあります。 これらのモジュールのメソッドと関数は、URLを検証するだけの最も単純な作業、またはCookieとセッションを処理する複雑な作業を実行できます。 この章では、インターネットプロトコルに使用される最も有名なpythonモジュールを見ていきます。
Protocol | Python Module Name | Description |
---|---|---|
HTTP | urllib.request | Opening the HTTP URL |
HTTP | urllib.response | Create a reponse object for a url request |
HTTP | urllib.parse | To break Uniform Resource Locator (URL) strings up in components like (addressing scheme, network location, path etc.), |
HTTP | urllib.robotparser | It finds out whether or not a particular user agent can fetch a URL on the Web site that published the robots.txt file. |
FTP | ftplib | implements the client side of the FTP protocol. You can use this to write Python programs that perform a variety of automated FTP jobs, such as mirroring other FTP servers. |
POP | poplib | This module defines a class, POP3, which encapsulates a connection to a POP3 server to read messages from a email server |
IMAP | imaplib | This module defines three classes, IMAP4, IMAP4_SSL and IMAP4_stream, which encapsulate a connection to an IMAP4 server to read emails. |
SMTP | smtplib | The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP listner deamon. |
Telnet | telnet | This module provides a Telnet class that implements the Telnet protocol to access a server thorugh teleent. |
それぞれについては、後続の章で詳しく説明します。