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
Articles on requests
Making plots in your terminal with plotext
By Bob Belderbos on 22 August 2022
In this blog post a quick script to plot the frequency of our blog articles in the terminal. It’s good to see that we’re getting back on track 🙂 The code gist is here. First we import the libraries we are going to use. As always we separate Standard Library modules from 3rd party ones… Continue reading Making plots in your terminal with plotext
There is More Than One Way to Solve a Bite Exercise
By Harrison Morgan on 21 August 2020
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.
How to Debug a Hanging Test Using pytest
By Bob Belderbos on 18 March 2020
Today a wanted to share a neat trick that might save you some headache: debugging a hanging test.
Talking to API’s and goodlooking tools
By Cedric Sambre on 24 February 2020
I recently ran into a tool called VTScan that uses the VirusTotal API to scan a file and print the results. I figured I could write the same, and add some functionality!
The Pythonic Fast Lane, Digest of a 30 Min Mentoring Session
By Bob Belderbos on 12 February 2020
The other day I had an awesome mentoring session with a beginner Pythonista, amazing what 30 min of screen sharing can do. Read on to learn more …
Building a Python Tips API with Django REST Framework and Deploying it to Digital Ocean
By Bob Belderbos on 5 March 2019
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
By Bob Belderbos on 26 February 2019
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
By Bob Belderbos on 19 February 2019
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?
Automating PyBites Review Post Using Github API and collections.defaultdict
By Bob Belderbos on 13 November 2018
In this post I share a quick script I produced last week to automate a portion of our review post. There are some nice idioms that you might find useful.