Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more [2 ed.] 1800207085, 9781800207080

Get a firm grip on the core processes including browser automation, web scraping, Word, Excel, and GUI automation with P

2,110 165 9MB

English Pages 526 [527] Year 2020

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Cover
Copyright
Packt Page
Contributors
Table of Contents
Preface
Chapter 1: Let's Begin Our Automation Journey
Activating a virtual environment
Installing third-party packages
Creating strings with formatted values
Manipulating strings
Extracting data from structured strings
Using a third-party tool—parse
Introducing regular expressions
Going deeper into regular expressions
Adding command-line arguments
Chapter 2: Automating Tasks Made Easy
Preparing a task
Setting up a cron job
Capturing errors and problems
Sending email notifications
Chapter 3: Building Your First Web Scraping Application
Downloading web pages
Parsing HTML
Crawling the web
Subscribing to feeds
Accessing web APIs
Interacting with forms
Using Selenium for advanced interaction
Accessing password-protected pages
Speeding up web scraping
Chapter 4: Searching and Reading Local Files
Crawling and searching directories
Reading text files
Dealing with encodings
Reading CSV files
Reading log files
Reading file metadata
Reading images
Reading PDF files
Reading Word documents
Scanning documents for a keyword
Chapter 5: Generating Fantastic Reports
Creating a simple report in plain text
Using templates for reports
Formatting text in Markdown
Writing a basic Word document
Styling a Word document
Generating structure in Word documents
Adding pictures to Word documents
Writing a simple PDF document
Structuring a PDF
Aggregating PDF reports
Watermarking and encrypting a PDF
Chapter 6: Fun with Spreadsheets
Writing a CSV spreadsheet
Updating CSV files
Reading an Excel spreadsheet
Updating an Excel spreadsheet
Creating new sheets in an Excel spreadsheet
Creating charts in Excel
Working with cell formats in Excel
Creating a macro in LibreOffice
Chapter 7: Cleaning and Processing Data
Prepare a CSV spreadsheet
Append currency based on location
Standardize the date format
Aggregate results
Process data in parallel
Process data with Pandas
Chapter 8: Developing Stunning Graphs
Plotting a simple sales graph
Drawing stacked bars
Plotting pie charts
Displaying multiple lines
Drawing a scatter plot
Visualizing maps
Adding legends and annotations
Combining graphs
Saving charts
Chapter 9: Dealing with Communication Channels
Working with email templates
Sending an individual email
Reading an email
Adding subscribers to an email newsletter
Sending notifications via email
Producing SMS messages
Receiving SMS
Creating a Telegram bot
Chapter 10: Why Not Automate Your Marketing Campaign?
Introduction
Detecting opportunities
Creating personalized coupon codes
Sending a notification to a customer on their preferred channel
Preparing sales information
Generating a sales report
Chapter 11: Machine Learning for Automation
Introduction
Analyse images with Google Cloud Vision AI
Extract text from images with Google Cloud Vision AI
Analyse text with Google Cloud Natural Language
Create your own custom machine learning model to classify text
Chapter 12: Automatic Testing Routines
Introduction
Write and execute test cases
Test external code
Test using dependency mocking
Test using HTTP call mocking
Prepare testing scenarios
Run tests selectively
Chapter 13: Debugging Techniques
Introduction
Learning Python interpreter basics
Debugging through logging
Debugging with breakpoints
Improving your debugging skills
Other Books You
May Enjoy
Index

Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more [2 ed.]
 1800207085, 9781800207080

  • Commentary
  • True PDF
  • 1 1 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers