Learning Python Network Programming
eBook - ePub

Learning Python Network Programming

Dr. M. O. Faruque Sarker, Sam Washington

Partager le livre
  1. 320 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Learning Python Network Programming

Dr. M. O. Faruque Sarker, Sam Washington

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

About This Book

  • Leverage your Python programming skills to build powerful network applications
  • Explore steps to interact with a wide range of network services
  • Design multithreaded and event-driven architectures for echo and chat servers

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. Basic knowledge of Python is assumed.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Learning Python Network Programming est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Learning Python Network Programming par Dr. M. O. Faruque Sarker, Sam Washington en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatica et Reti di computer. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2015
ISBN
9781784391157
Édition
1

Learning Python Network Programming


Table of Contents

Learning Python Network Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Virtual environments
Installing Python 3
Ubuntu and Debian
RHEL, CentOS, Scientific Linux
Fedora
Alternative installation methods
Pythonz
JuJu
Windows
Other requirements
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Network Programming and Python
An introduction to TCP/IP networks
IP addresses
Network interfaces
Assigning IP addresses
IP addresses on the Internet
Packets
Networks
Routing with IP
DNS
The protocol stack or why the Internet is like a cake
Layer 4 – TCP and UDP
Network ports
UDP
TCP
UDP versus TCP
Layer 5 – The application layer
On to Python!
Network programming with Python
Breaking a few eggs
Taking it from the top
Downloading an RFC
Looking deeper
Programming for TCP/IP networks
Firewalls
Network Address Translation
IPv6
Summary
2. HTTP and Working with the Web
Request and response
Requests with urllib
Response objects
Status codes
Handling problems
HTTP headers
Customizing requests
Content compression
Multiple values
Content negotiation
Content types
User agents
Cookies
Cookie handling
Know your cookies
Redirects
URLs
Paths and relative URLs
Query strings
URL encoding
URLs in summary
HTTP methods
The HEAD method
The POST method
Formal inspection
HTTPS
The Requests library
Handling errors with Requests
Summary
3. APIs in Action
Getting started with XML
The XML APIs
The basics of ElementTree
Pretty printing
Element attributes
Converting to text
The Amazon S3 API
Registering with AWS
Authentication
Setting up an AWS user
Regions
S3 buckets and objects
An S3 command-line client
Creating a bucket with the API
Uploading a file
Retrieving an uploaded file through a web browser
Displaying an uploaded file in a web browser
Downloading a file with the API
Parsing XML and handling errors
Parsing XML
Finding elements
Handling errors
Further enhancements
The Boto package
Wrapping up with S3
JSON
Encoding and decoding
Using dicts with JSON
Other object types
The Twitter API
A Twitter world clock
Authentication for Twitter
Registering your application for the Twitter API
Authenticating requests
A Twitter client
Polling for Tweets
Processing the Tweets
Rate limits
Sending a reply
Final touches
Taking it further
Polling and the Twitter streaming APIs
Alternative oAuth flows
HTML and screen scraping
HTML parsers
Show me the data
Parsing HTML with lxml
Zeroing in
Searching with XPath
XPath conditions
Pulling it together
With great power...
Choosing a User Agent
The Robots.txt file
Summary
4. Engaging with E-mails
E-mail terminologies
Sending e-mails with SMTP
Composing an e-mail message
Sending an e-mail message
Sending e-mails securely with TLS
Retrieving e-mails by using POP3 with poplib
Retrieving e-mails by using IMAP with imaplib
Sending e-mail attachments
Sending e-mails via the logging module
Summary
5. Interacting with Remote Systems
Secure shell – access using Python
Inspecting the SSH packets
Transferring files through SFTP
Transferring files with FTP
Inspecting FTP packets
Fetching Simple Network Management Protocol data
Inspecting SNMP packets
Reading Light-weight Directory Access Protocol data
Inspecting LDAP packets
Sharing files with SAMBA
Inspecting SAMBA packets
Summary
6. IP and DNS
Retrieving the network configuration of a local machine
Manipulating IP addresses
IP network objects
Network interface objects
The IP address objects
Planning IP addresses for your local area network
GeoIP look-ups
DNS look-ups
Inspecting DNS client/server communication
NTP clients
Inspecting the NTP client/server communication
Summary
7. Programming with Sockets
Basics of sockets
Working with TCP sockets
Inspecting the client/server communication
TCP servers
Inspecting client/server interaction
Working with UDP sockets
TCP port forwarding
A non-blocking socket I/O
Securing sockets with TLS/SSL
Inspecting standard SSL client/server communication
Creating a custom SSL client/server
Inspecting interaction between a custom SSL client/server
Summary
8. Client and Server Applications
Client and server
An echo protocol
Framing
A simple echo server
Handling the received data
The server itself
A simple echo client
Concurrent I/O
Multithreading and multiprocessing
Threading and the GIL
A multithreaded echo server
Designing a chat server
A chat protocol
Handling data on persistent connections
A multithreaded chat server
Queues
Locks
A multithreaded chat client
Event-driven servers
A low-level event-driven chat server
Frameworks
An eventlet-based chat server
An asyncio-based chat server
More on frameworks
Taking our servers forward
Summary
9. Applications for the Web
What's in a web server?
Python and the Web
Web frameworks
Flask – a microframework
Templating
Other templating engines
Adding some style
A note on security
XSS
CSRF
Finishing up with frameworks
Hosting Python web applications
CGI
Recycling for a better world
Event-driven servers
WSGI
Hosting in practice
Summary
A. Working with Wireshark
Packet sniffers
Wireshark
Installation
Capturing some packets
Filtering
Inspecting packets
A versatile tool
Index

Learning Python Network Programming

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2015
Production reference: 1100615
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-600-8
www.packtpub.com

Credits

Authors
Dr. M. O. F...

Table des matiĂšres