Skip to content

Commit

Permalink
Add a default timeout parameter to retrieve_json
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaj committed Mar 11, 2016
1 parent da3c286 commit 15efe5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/http.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import requests

def retrieve_json(url):
r = requests.get(url)

DEFAULT_TIMEOUT = 10


def retrieve_json(url, timeout=DEFAULT_TIMEOUT):
r = requests.get(url, timeout=timeout)
r.raise_for_status()
return r.json()

0 comments on commit 15efe5e

Please sign in to comment.