However Publishing, 2021. — 527 p. — ISBN 978-1-80020-708-0.
We are all probably spending time doing small manual tasks that don't add much value. It may be scanning through information sources in search of the small bits of relevant information, working with spreadsheets to generate the same graph over and over, or searching files one by one until we find the data we're looking for. Some — probably most — of those tasks are, in fact, automatable. There's an investment upfront, but for the tasks that get repeated over and over, we can use computers to do these kinds of menial tasks and focus our own efforts instead on what humans are good for — high-level analysis and decision making based on the result. This book will explain how to use the Python language to automate common business tasks that can be greatly sped up if a computer is doing them.
Given the expressiveness and ease of use of Python, it's surprisingly simple to start making small programs to perform these actions and combine them into more integrated systems. Throughout the book, we will show small, easy-to-follow recipes that can be adapted to your specific needs, and we will ombine them to perform more complex actions. We will perform common actions, such as detecting opportunities by scraping the web, analyzing information to generate automatic
spreadsheet reports with graphs, communicating with automatically generated emails, getting notifications via text messages, and learning how to run tasks while your mind is focused on other more important stuff.
Though some Python knowledge is required, the book is written with nonprogrammers in mind, giving clear and instructive recipes that will further the reader's proficiency while being oriented to specific day-to-day goals
Who this book is forThis book is for Python beginners, not necessarily developers, that want to use and expand their knowledge to automate tasks. Most of the examples in the book are aimed at marketing, sales, and other non-tech areas. The reader needs to know a little of the Python language, including its basic concepts.
Preface
Let's Begin Our Automation JourneyActivating 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
Automating Tasks Made EasyPreparing a task
Setting up a cron job
Capturing errors and problems
Sending email notifications
Building Your First Web Scraping ApplicationDownloading 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
Searching and Reading Local FilesCrawling 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
Generating Fantastic ReportsCreating 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
Fun with SpreadsheetsWriting 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
Cleaning and Processing DataPreparing a CSV spreadsheet
Appending currency based on location
Standardizing the date format
Aggregating results
Processing data in parallel
Processing data with Pandas
Developing Stunning GraphsPlotting 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
Dealing with Communication ChannelsWorking 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
Why Not Automate Your Marketing Campaign?Detecting opportunities
Creating personalized coupon codes
Sending a notification to a customer on their preferred channel
Preparing sales information
Generating a sales report
Machine Learning for AutomationAnalyzing images with Google Cloud Vision AI
Extracting text from images with Google Cloud Vision AI
Analyzing text with Google Cloud Natural Language
Creating your own custom machine learning model to classify text
Automatic Testing RoutinesWriting and executing test cases
Testing external code
Testing using dependency mocking
Testing using HTTP call mocking
Preparing testing scenarios
Running tests selectively
Debugging TechniquesLearning Python interpreter basics
Debugging through logging
Debugging with breakpoints
Improving your debugging skills
Other Books You May Enjoy
Index