Avoiding Silent Failures in Python: Best Practices for Error Handling

In the world of programming, errors are inevitable. But how we choose to handle these errors can make the difference between a system that is robust and user-friendly and one that is fraught with ambiguous issues 😱 The Zen of Python famously states, “Errors should never pass silently.” This principle emphasizes the importance of addressing… Continue reading Avoiding Silent Failures in Python: Best Practices for Error Handling

There is More Than One Way to Solve a Bite Exercise

According to the Zen of Python, “There should be one– and preferably only one –obvious way to do it.” It’s a good principle for designing a program: the more ways there are of doing something, the more confusing the software becomes, along with a host of other problems. In reality, though, there almost always is more than one way to accomplish something. The quotation even displays this fact: it places the dash in two different ways, neither of which are the obvious way.

Building a Python Tips API with Django REST Framework and Deploying it to Digital Ocean

In this article I will show you how to build a simple API for our growing collection of Python tips. First we make a simple Django app, defining the model. Next we use Django REST Framework to make an API supporting common CRUD operations. Then we will test it out using curl, Postman and Django REST’s browser front-end. Lastly we deploy the API to Digital Ocean so we can start using it via our Slack with a Slash Command, which I will cover in the next article. Sounds exciting? You bet it is! Let’s jump straight in!

Generating Beautiful Code Snippets with Carbon and Selenium

Did you notice our Python tips lately? They looks more sexy, don’t they? That’s thanks to Carbon which lets you create beautiful images of your source code. As much as I love its interface though, what if we can automate this process generating the image for us? That’s what we did and posting new tips to Twitter is now a breeze. In this article I will show you how using a bit of BeautifulSoup and selenium. Enjoy!

How to Parse Hidden HTML With Selenium Headless Mode and Deploy it to Heroku

Ever wondered how you scrape hidden (or JS generated) HTML? Selenium is your friend. Ever wondered how to run it without a browser popping up? Use headless mode. How would you run it remotely? Use Heroku. And how about autoposting to Slack and Twitter? With the right libraries and API setup little code is needed. In this 10 step guide I will show you how to build a Packt Free Learning Notifier which will accomplish all these tasks. Ready to learn some nice automation skills in Python?