From 5100021f20514dc9e1c69ade07ce53030c54b3a6 Mon Sep 17 00:00:00 2001 From: Evaldas Taroza Date: Wed, 19 Jan 2022 13:51:33 +0100 Subject: [PATCH] =?UTF-8?q?Respect=20=E2=80=9Cformat=E2=80=9D=20parameter?= =?UTF-8?q?=20when=20returning=20the=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- nomics/api/candles.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 22ce0da..9bc7fa6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ /.pytest_cache /.vscode -.env \ No newline at end of file +.env + +.idea \ No newline at end of file diff --git a/nomics/api/candles.py b/nomics/api/candles.py index e2b5577..d00b0b4 100644 --- a/nomics/api/candles.py +++ b/nomics/api/candles.py @@ -56,6 +56,9 @@ def get_candles(self, interval, currency = None, base = None, quote = None, exch resp = requests.get(url, params = params) if resp.status_code == 200: - return resp.json() + if format and format == 'csv': + return resp.text + else: + return resp.json() else: - return resp.text \ No newline at end of file + return resp.text