pydomo - dataset export json.decoder.JSONDecodeError
Hey Everyone,
I've been using the new PyDomo libarary in python 3.x and it has been working great... until I try to export a dataset at which point I get:
File "C:\Users\UserName\Python35\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
My early hunch is that this is due to the api call returning the data as a bit-string which would need to be converted to a string before being deconded by the json package.
Code to reproduce:
from pydomo import Domo
import logging
import json
domo_id = Insert domo api user ID as string here
domo_secret = Insert Domo secret as string here
dataset_id = Insert Dataset ID as string here
destination_path = 'C:\\Users\\Username\\Documents\\test_data.csv'
include_csv_header = True
domo = Domo(domo_id,domo_secret,'api.domo.com',True,'42N',logging.INFO)
csv_file = domo.datasets.data_export_to_file(dataset_id,destination_path,include_csv_header)
Has anyone run into anything similar / know if a fix is possible without making changes to the package?
Thanks,
Austin
Best Answer
-
Update:
The error goes away as long as I call the get metadata api before hand, like so:
from pydomo import Domo
import logging
import json
domo_id = Insert domo api user ID as string here
domo_secret = Insert Domo secret as string here
dataset_id = Insert Dataset ID as string here
destination_path = 'C:\\Users\\Username\\Documents\\test_data.csv'
include_csv_header = True
domo = Domo(domo_id,domo_secret,'api.domo.com',True,'42N',logging.INFO)
dump_meta = domo.datasets.get(dataset_id)
csv_file = domo.datasets.data_export_to_file(dataset_id,destination_path,include_csv_header)Only difference I see between the calls is that datasets.get forces a renewal of the token while the datasets.data_export_to_file does not. Could this be it?
0
Answers
-
Update:
The error goes away as long as I call the get metadata api before hand, like so:
from pydomo import Domo
import logging
import json
domo_id = Insert domo api user ID as string here
domo_secret = Insert Domo secret as string here
dataset_id = Insert Dataset ID as string here
destination_path = 'C:\\Users\\Username\\Documents\\test_data.csv'
include_csv_header = True
domo = Domo(domo_id,domo_secret,'api.domo.com',True,'42N',logging.INFO)
dump_meta = domo.datasets.get(dataset_id)
csv_file = domo.datasets.data_export_to_file(dataset_id,destination_path,include_csv_header)Only difference I see between the calls is that datasets.get forces a renewal of the token while the datasets.data_export_to_file does not. Could this be it?
0 -
The same thing happened to me.
It would be nice to fix pydomo.0 -
-
@anafziger & @user06158 - I'm the Product manager over our APIs and SDKs. Sorry for the inconvenience.
We'll take a look into the issue with our team and update as soon as possible.
Thanks,
2 -
Thank you for reply.
I am looking forward to more great improvment from DOMO.
0 -
This issue was caused by an oversight in automatic authentication. Authentication in pydomo has been revisited and centralized to the "request" function in the Transport class (Transport.py line 54).
This fix has been merged into master and published to PyPi. https://github.com/domoinc/domo-python-sdkPydomo v0.1.3 is available for install via `pip3 install pydomo --upgrade`
This update has added 'requests_toolbelt' as a dependency, please install it via `pip3 install requests_toolbelt`
1 -
@anafziger, @user06158 -
A quick update that hopefully you'll see in this thread. We've been able to push out a newer verison of the SDK that should address the issue.Sorry for the incovenience, we appreciate you pointing out the bug.
Thanks!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive