Allow for the call to define the timeout, set at a default of 30secs

This commit is contained in:
2011-06-15 12:07:08 +01:00
parent bdcb572645
commit edac3d83dc
2 changed files with 3 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ class CachedDocumentManager(models.Manager):
return url
def api_query(self, url_path, params={}, no_cache=False, exceptions=True, service="Auth"):
def api_query(self, url_path, params={}, no_cache=False, exceptions=True, timeout=30, service="Auth"):
"""
Transparently handles querying EVE API or retrieving the document from
the cache.
@@ -69,7 +69,7 @@ class CachedDocumentManager(models.Manager):
if sys.version_info < (2, 6):
conn = urllib2.urlopen(req)
else:
conn = urllib2.urlopen(req, timeout=5)
conn = urllib2.urlopen(req, timeout=timeout)
except urllib2.HTTPError, e:
print "HTTP Error Code: %s" % e.code
raise DocumentRetrievalError(e.code)