Writing Python unit tests for HTTP Clients

I have a nagios / icinga HTTP monitor based on PyCurl: check_pycurl3. Writing tests for this is difficult because: So with a little StackExchange googling, you can start Flask in a thread (remember to set daemon=True) like below: You also need to give it some time to start up before tests commence, I’ve used the …

Continue reading ‘Writing Python unit tests for HTTP Clients’ »

Monitor mail queue with filter

check_mailq_filter – an Icinga / Nagios postfix mail queue monitor with a filter (include or exclude mails matching a pattern). So to exclude facebook mails from your monitor you may run: check_mailq_filter.py -x ‘.*facebookmail.*’ While you’re here, have a look at pfqueue – a console tool for interactively viewing your postfix queue that’s a step …

Continue reading ‘Monitor mail queue with filter’ »

python pipenv package for fedora 27

Package from the COPR didn’t work for me due to outdated dependencies, so I’ve modified the SPEC file it’s based on. To create RPM: Download SPEC file (above) Follow “Preparing your system to create RPM packages” Download pipenv-11.1.3.tar.gz Run fedpkg –release f27 local Note: I’ve only created python 3 package.

Dynamic DNS updating in python with ipify

I’ve used free Dynamic DNS services to give my home machine a “static” address in the past but they either start charging or have poor performance. As I run my own external nameserver, why not use RFC 2136 to dynamically update the address based on the IP from ipify? So with some python scripting, that’s …

Continue reading ‘Dynamic DNS updating in python with ipify’ »