Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Decode floats to Decimal. #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion coinmarketcap/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import sys
import decimal
import json
import requests
import tempfile
Expand Down Expand Up @@ -34,7 +35,7 @@ def __request(self, endpoint, params):
response_object = self.session.get(self.base_url + endpoint, params = params, timeout = self.request_timeout)

try:
response = json.loads(response_object.text)
response = json.loads(response_object.text, parse_float=decimal.Decimal)

if isinstance(response, list) and response_object.status_code == 200:
response = [dict(item, **{u'cached':response_object.from_cache}) for item in response]
Expand Down