Skip to content

Commit

Permalink
add minimal comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Sep 12, 2015
1 parent e850940 commit 28d9713
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions collect-data/collect_books.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@


def format_book_entry(entry):
'''
Converts book data to float
'''
if all(key in entry for key in ('amount', 'price', 'timestamp')):
entry['amount'] = float(entry['amount'])
entry['price'] = float(entry['price'])
Expand All @@ -24,6 +27,9 @@ def format_book_entry(entry):


def get_json(url):
'''
Gets json from the API
'''
resp = urllib2.urlopen(url)
return json.load(resp, object_hook=format_book_entry), resp.getcode()

Expand Down

0 comments on commit 28d9713

Please sign in to comment.