Merge pull request #242 from CartoDB/add_qps_to_isolines

Add qps to isolines
This commit is contained in:
Mario de Frutos
2016-07-29 16:25:38 +02:00
committed by GitHub
3 changed files with 4 additions and 2 deletions
@@ -1,5 +1,6 @@
import requests import requests
import json import json
from qps import qps_retry
class MatrixClient: class MatrixClient:
@@ -30,6 +31,7 @@ class MatrixClient:
Returns: Returns:
A dict with one_to_many, units and locations A dict with one_to_many, units and locations
""" """
@qps_retry
def one_to_many(self, locations, costing): def one_to_many(self, locations, costing):
request_params = { request_params = {
'json': json.dumps({'locations': locations}), 'json': json.dumps({'locations': locations}),
@@ -26,7 +26,7 @@ class QPSService:
try: try:
return fn(*args, **kwargs) return fn(*args, **kwargs)
except Exception as e: except Exception as e:
if hasattr(e, 'response') and e.response.status_code == 429: if hasattr(e, 'response') and (e.response.status_code == 429 or e.response.status_code == 504):
self.retry(start_time, attempt_number) self.retry(start_time, attempt_number)
else: else:
raise e raise e
+1 -1
View File
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
setup( setup(
name='cartodb_services', name='cartodb_services',
version='0.7.2.2', version='0.7.2.3',
description='CartoDB Services API Python Library', description='CartoDB Services API Python Library',