Batch API support

This commit is contained in:
Madison May
2014-12-18 15:27:16 -05:00
parent cc1d6dc502
commit 9ed17b8f34
9 changed files with 27 additions and 47 deletions
+3 -1
View File
@@ -4,8 +4,10 @@ from skimage.transform import resize
from indicoio import JSON_HEADERS
def api_handler(arg, url):
def api_handler(arg, url, batch=False):
data_dict = json.dumps({'data': arg})
if batch:
url += "/batch"
response = requests.post(url, data=data_dict, headers=JSON_HEADERS).json()
results = response.get('results', False)
if not results: