Skip to content

Commit

Permalink
Added HTTP timeout to avoid hanging forever.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Barr committed Apr 12, 2014
1 parent 46aa664 commit 69f14b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bitfinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
PATH_LENDBOOK = "lendbook/%s"
PATH_ORDERBOOK = "book/%s"

# HTTP request timeout in seconds
TIMEOUT = 5.0

class Client(object):
"""
Client for the bitfinex.com API.
Expand Down Expand Up @@ -176,7 +179,7 @@ def _convert_to_floats(self, data):


def _get(self, url):
return json.loads(requests.get(url).content.decode())
return requests.get(url, timeout=TIMEOUT).json()


def _build_parameters(self, parameters):
Expand Down

0 comments on commit 69f14b9

Please sign in to comment.