From c8d1c28aac85526cf7b326de14c2aaa05da03766 Mon Sep 17 00:00:00 2001 From: Kevin Lynch Date: Thu, 4 Sep 2014 17:47:40 -0400 Subject: [PATCH 1/2] library file is not executable --- catchpoint.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/catchpoint.py b/catchpoint.py index 4a6e34c..cb8dc29 100644 --- a/catchpoint.py +++ b/catchpoint.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - import sys import base64 import datetime From 7745381012d9482c6f45996635a71c3a3a9c2f04 Mon Sep 17 00:00:00 2001 From: Kevin Lynch Date: Mon, 8 Sep 2014 15:59:13 -0400 Subject: [PATCH 2/2] add logic to handle exceptional cases (e.g. quota over limit errors) --- catchpoint.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/catchpoint.py b/catchpoint.py index cb8dc29..28e220e 100644 --- a/catchpoint.py +++ b/catchpoint.py @@ -5,6 +5,10 @@ import requests +class CatchpointError(Exception): + pass + + class Catchpoint(object): def __init__( @@ -80,6 +84,8 @@ def _make_request(self, uri, params=None, data=None): } try: r = requests.get(uri, headers=headers, params=params, data=data) + if r.status_code != 200: + raise CatchpointError(r.content) except requests.ConnectionError, e: self._connection_error(e)