This post was initially published in August 9, 2015.

We use Jenkins to build perform nightly build of our software at work. A few months ago, we had some reliability problems with Jenkins and jobs did not always run every night.

Our Jenkins server sits behind a firewall and it cannot send email to an external address. I also do not want to bring my work laptop home.

So I wrote a simple script to retrieve job status from Jenkins on my workstation but the script needs to send me a notification (so I can check the status on my iPhone/Apple Watch).

My workstation also sits behind the firewall and it has no direct Internet access. So this is what I needed to do to have the script send me a notification through proxy. The script uses API from to send an notification.

import urllib
import urllib2

if __name__ == "__main__":
    # Use your own username/password and proxy server (and port number)
    # for proxy_auth_url
    proxy_auth_url = 'http://username:password@proxy_server:port_num'
    proxies = {'http': proxy_auth_url, 'https': proxy_auth_url}
    proxy_handler = urllib2.ProxyHandler(proxies)
    opener = urllib2.build_opener(proxy_handler)
    # Content of the message depends on the job status
    message = 'Jenkins job status: successful'
    payload = urllib.urlencode({'token': 'pushover_api_token',
                                'user': 'pushover_user_key',
                                'message': message})
    request = urllib2.Request('',
                              headers = {'Content-type': 'application/x-www-form-urlencoded'})
    response =