diff --git a/detectlanguage/client.py b/detectlanguage/client.py index fa0f6d5..999ca45 100644 --- a/detectlanguage/client.py +++ b/detectlanguage/client.py @@ -13,11 +13,11 @@ def __init__(self, configuration): self.configuration = configuration def get(self, path, payload = {}): - r = requests.get(self.url(path), params=payload, headers = self.headers()) + r = requests.get(self.url(path), params=payload, headers = self.headers(), timeout = self.configuration.timeout) return self.handle_response(r) def post(self, path, payload): - r = requests.post(self.url(path), json=payload, headers = self.headers()) + r = requests.post(self.url(path), json=payload, headers = self.headers(), timeout = self.configuration.timeout) return self.handle_response(r) def handle_response(self, r): diff --git a/detectlanguage/configuration.py b/detectlanguage/configuration.py index bd73c3f..2fb0482 100644 --- a/detectlanguage/configuration.py +++ b/detectlanguage/configuration.py @@ -6,3 +6,4 @@ class Configuration: host = 'ws.detectlanguage.com' user_agent = 'Detect Language API Python Client ' + detectlanguage.__version__ secure = False + timeout = 5