Book description
Achieve improved network programmability and automation by leveraging powerful network programming concepts, algorithms, and tools
Key Features
- Deal with remote network servers using SSH, FTP, SNMP and LDAP protocols.
- Design multi threaded and event-driven architectures for asynchronous servers programming.
- Leverage your Python programming skills to build powerful network applications
Book Description
Network programming has always been a demanding task. With full-featured and well-documented libraries all the way up the stack, Python makes network programming the enjoyable experience it should be.
Starting with a walk through of today's major networking protocols, through this book, you'll learn how to employ Python for network programming, how to request and retrieve web resources, and how to extract data in major formats over the web. You will utilize Python for emailing using different protocols, and you'll interact with remote systems and IP and DNS networking. You will cover the connection of networking devices and configuration using Python 3.7, along with cloud-based network management tasks using Python.
As the book progresses, socket programming will be covered, followed by how to design servers, and the pros and cons of multithreaded and event-driven architectures. You'll develop practical clientside applications, including web API clients, email clients, SSH, and FTP. These applications will also be implemented through existing web application frameworks.
What you will learn
- Execute Python modules on networking tools
- Automate tasks regarding the analysis and extraction of information from a network
- Get to grips with asynchronous programming modules available in Python
- Get to grips with IP address manipulation modules using Python programming
- Understand the main frameworks available in Python that are focused on web application
- Manipulate IP addresses and perform CIDR calculations
Who this book is for
If you're a Python developer or a system administrator with Python experience and you're looking to take your first steps in network programming, then this book is for you. If you're a network engineer or a network professional aiming to be more productive and efficient in networking programmability and automation then this book would serve as a useful resource. Basic knowledge of Python is assumed.
Table of contents
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Preface
- Section 1: Introduction to Network and HTTP Programming
-
Network Programming with Python
- Technical requirements
- An introduction to TCP/IP networking
- Protocol concepts and the problems that protocols solve
- Addressing
- Python network programming through libraries
- Interacting with Wireshark with pyshark
- Summary
- Questions
- Further reading
-
Programming for the Web with HTTP
- Technical requirements
- Consuming web services in Python with urllib
- Consuming web services in Python with requests
- Handling forms with urllib and requests with Python 3.7
- Handling cookies with urllib and requests with Python
- Handling HTTP Basic and Digest Authentication with requests
- Summary
- Questions
- Further reading
- Section 2: Interacting with APIs, Web Scraping, and Server Scripting
-
Application Programming Interface in Action
- Technical requirements
- Introduction to REST APIs
- Introduction to JSON and the JSON module
- Interacting with a JSON hybrid-REST API (Twitter)
- Introduction to XML
- Working with XML and a full REST API (Amazon S3 bucket) with the Boto module
- Summary
- Questions
- Further reading
-
Web Scraping with BeautifulSoup and Scrapy
- Technical requirements
- Introduction to web scraping
- Extracting information from web pages and parsing HTML with BeautifulSoup
- Introduction to Scrapy components and architecture
- Scrapy as a framework for performing web crawling processes and data analysis
- Working with Scrapy in the cloud
- Summary
- Questions
- Further reading
-
Engaging with Email
- Technical requirements
- Introduction to email protocols
- Sending emails with SMTP through the smtplib library
- Learning the POP3 protocol and retrieving emails with poplib
- Manipulating and retrieving emails on the server email using IMAP with imapclient and imaplib
- Summary
- Questions
- Further reading
- Interacting with Remote Systems
- Section 3: IP Address Manipulation and Network Automation
-
Working with IP and DNS
- Technical requirements
- Principles of the IP protocol
- Retrieving the network configuration of a local machine
- Using Python to manipulate IP addresses and perform CIDR calculations
- The dnspython module as a tool for extracting information from DNS servers
- GeoIP lookups with pygeoip and python-geoip
- Summary
- Questions
- Further reading
-
Implementing IPv6 and Address Manipulation
- Technical requirements
- Learning and understanding the IPv6 protocol
- Create an echo client and server with IPv6
- Understanding netifaces module for checking IPv6 support on your network
- Using the netaddr module as a network-address manipulation library for Python
- Understand ipaddress module as IPv4 and IPv6 manipulation library
- Summary
- Questions
- Further reading
- Performing Network Automation with Python and Ansible
- Section 4: Sockets and Server Programming
-
Programming with Sockets
- Technical requirements
- Basics of sockets
- Working with UDP and TCP sockets in Python 3.7
- Working with IPv6 sockets in Python 3.7
- Non-blocking and asynchronous socket I/O
- HTTPS and securing sockets with TLS
- Summary
- Questions
- Further reading
-
Designing Servers and Asynchronous Programming
- Technical requirements
- Building a multiprocessing-based TCP server
- Building asynchronous applications with asyncio and aiohttp
- Building asynchronous network applications with Tornado
- Building asynchronous network applications with Twisted
- Building asynchronous network applications with Celery
- Summary
- Questions
- Further reading
-
Designing Applications on the Web
- Technical requirements
- Writing a web application with WSGI
- Existing web application frameworks (Django, Flask, and Plone)
- The MVC pattern and dynamic web programming with Python
- Creating RESTful web applications and working with Flask and HTTP requests
- Working with a database in Flask with SQLAlchemy
- Summary
- Questions
- Further reading
-
Assessment
- Chapter 1, Network Programming with Python
- Chapter 2, Programming for the Web with HTTP
- Chapter 3, Application Programming Interface in Action
- Chapter 4, Web Scraping with BeautifulSoup and Scrapy
- Chapter 5, Engaging with Email
- Chapter 6, Interacting with Remote Systems
- Chapter 7, Working with IP and DNS
- Chapter 8, Implementing IPv6 and Address Manipulation
- Chapter 9, Performing Network Automation with Python and Ansible
- Chapter 10, Programming with Sockets
- Chapter 11, Designing Servers and Asynchronous Programming
- Chapter 12, Designing Applications on the Web
- Another Book You May Enjoy
Product information
- Title: Learning Python Networking - Second Edition
- Author(s):
- Release date: March 2019
- Publisher(s): Packt Publishing
- ISBN: 9781789958096
You might also like
book
Mastering Python Networking - Second Edition
Key Features Explore the power of Python libraries to tackle difficult network problems efficiently and effectively …
book
Mastering Python Networking
Become an expert in implementing advanced, network-related tasks with Python. Key Features Build the skills to …
book
Learning Python Network Programming
Utilize Python 3 to get network applications up and running quickly and easily In Detail Network …
book
Python Network Programming Techniques
Become well-versed with network programmability by solving the most commonly encountered problems using Python 3 and …