summaryrefslogtreecommitdiffstats
path: root/server-handler/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'server-handler/api.py')
-rw-r--r--server-handler/api.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/server-handler/api.py b/server-handler/api.py
index 162af1c..0ed4b7c 100644
--- a/server-handler/api.py
+++ b/server-handler/api.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-from google.appengine.api.urlfetch import fetch
+from google.appengine.api.urlfetch import fetch, DownloadError
from urllib import quote_plus
from django.utils.simplejson import loads
from google.appengine.ext import db
import re
import cgitb
+import logging
class AnyClipAPIData(db.Model):
apiKey = db.StringProperty(required=True)
@@ -30,7 +31,11 @@ class AnyClipAPI():
url = "http://api.anyclip.com/ac_api/v1/%s/json/%s/" % (self.apiData.token, method)
for arg in args:
url += "%s/" % quote_plus(str(arg))
- response = fetch(url)
+ try:
+ response = fetch(url)
+ except DownloadError:
+ logging.debug("Error on " + url)
+ raise
if response.status_code != 200:
return ("", "")
error = self.errorMatch.search(response.content)