[AETHER-3114] Handle 500 error when making ROC request

Change-Id: If920152a426ba079e3acaacfe96691cc6897b3b0
diff --git a/prom.py b/prom.py
index 5c4668c..2a9f1ce 100644
--- a/prom.py
+++ b/prom.py
@@ -28,7 +28,11 @@
         params = (
             ('query', 'subscribers_info>0'),
         )
-        response = requests.get(PROMETHEUS, params=params, auth=(self.key, self.token))
+        try:
+            response = requests.get(PROMETHEUS, params=params, auth=(self.key, self.token), timeout=10)
+        except requests.ReadTimeout as e:
+            log.error("Rancher/Prometheus request timeout, error={}".format(e))
+            sys.exit()
         if response.status_code != 200:
             log.error("get_subscriberinfo() failed, status_code: {}".format(response.status_code))
             return None
@@ -44,7 +48,11 @@
             ('query', 'subscribers_info'),
         )
 
-        response = requests.get(PROMETHEUS, params=params, auth=(self.key, self.token))
+        try:
+            response = requests.get(PROMETHEUS, params=params, auth=(self.key, self.token), timeout=10)
+        except requests.ReadTimeout as e:
+            log.error("Rancher/Prometheus request timeout, error={}".format(e))
+            sys.exit()
         if response.status_code != 200:
             log.error("get_subscriberinfo() failed, status_code: {}".format(response.status_code))
             sys.exit()
@@ -64,6 +72,8 @@
             else:
                 log.error("Ignoring device as imsi or mobile-ip not found - {}".format(metric))
 
+        return devices
+
     def dump(self):
         print(pyaml.dump(self.get_ips()))