Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions detectlanguage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions detectlanguage/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ class Configuration:
host = 'ws.detectlanguage.com'
user_agent = 'Detect Language API Python Client ' + detectlanguage.__version__
secure = False
timeout = 5