Passing in a root_url variable and pulling config from environment variables

This commit is contained in:
Anne Carlson
2015-02-27 16:32:32 -05:00
committed by Madison May
parent a1621e8531
commit 6b9251f4f5
7 changed files with 39 additions and 37 deletions
+5 -4
View File
@@ -1,8 +1,9 @@
from indicoio.utils import api_handler
import indicoio.config as config
def language(api_root, text, batch=False, auth=None, **kwargs):
def language(text, url_root=config.api_root, batch=False, auth=None, **kwargs):
"""
Given input text, returns a probability distribution over 33 possible
Given input text, returns a probability distribution over 33 possible
languages of what language the text was written in.
Example usage:
@@ -22,5 +23,5 @@ def language(api_root, text, batch=False, auth=None, **kwargs):
:type text: str or unicode
:rtype: Dictionary of language probability pairs
"""
return api_handler(text, api_root + "language", batch=batch, auth=auth, **kwargs)
return api_handler(text, url_root + "language", batch=batch, auth=auth, **kwargs)