Python - Internet Protocol


The Internet Protocol is designed to implement a uniform system of addresses on all of the Internet-connected computers everywhere and to make it possible for packets to travel from one end of the Internet to the other. A program like the web browser should be able to connect to a host anywhere without ever knowing which maze of network devices each packet is traversing on its journey. There are various categories of internet protocols. Thes protocols are created to serve the needs of different types of data communication between different computers in the internet.

Python has several modules to handle each of these communication scenarios. The methods and functions in these modules can do the simplest job of just validating a URL or also the complex job of handling the cookies and sessions. In this chapter we will look at the most prominent python modules used for internet protocols.

Protocol Python Module Name Description
HTTPurllib.requestOpening the HTTP URL
HTTPurllib.response Create a reponse object for a url request
HTTPurllib.parseTo break Uniform Resource Locator (URL) strings up in components like (addressing scheme, network location, path etc.),
HTTPurllib.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.
FTPftplib 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.
POPpoplibThis module defines a class, POP3, which encapsulates a connection to a POP3 server to read messages from a email server
IMAPimaplibThis module defines three classes, IMAP4, IMAP4_SSL and IMAP4_stream, which encapsulate a connection to an IMAP4 server to read emails.
SMTPsmtplib 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.
TelnettelnetThis module provides a Telnet class that implements the Telnet protocol to access a server thorugh teleent.

Each of them is discussed in detail in the subsequent chapters.

Useful Video Courses


Python Online Training

Most Popular

187 Lectures 17.5 hours

Malhar Lathkar


Python Essentials Online Training

55 Lectures 8 hours

Arnab Chakraborty


Learn Python Programming in 100 Easy Steps

136 Lectures 11 hours

In28Minutes Official


Python with Data Science

75 Lectures 13 hours

Eduonix Learning Solutions


Python 3 from scratch to become a developer in demand

70 Lectures 8.5 hours

Lets Kode It


Python Data Science basics with Numpy, Pandas and Matplotlib

63 Lectures 6 hours

Abhilash Nelson