Merge pull request #243 from CartoDB/development

Added QPS for mapzen isolines
This commit is contained in:
Mario de Frutos 2016-07-29 16:28:13 +02:00 committed by GitHub
commit 073be9dae4
3 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import requests
import json
from qps import qps_retry
class MatrixClient:
@ -30,6 +31,7 @@ class MatrixClient:
Returns:
A dict with one_to_many, units and locations
"""
@qps_retry
def one_to_many(self, locations, costing):
request_params = {
'json': json.dumps({'locations': locations}),

View File

@ -26,7 +26,7 @@ class QPSService:
try:
return fn(*args, **kwargs)
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)
else:
raise e

View File

@ -10,7 +10,7 @@ from setuptools import setup, find_packages
setup(
name='cartodb_services',
version='0.7.2.2',
version='0.7.2.3',
description='CartoDB Services API Python Library',