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
-
The same thing happened to me.
It would be nice to fix pydomo.0 -
Dani aka "Mr.Dojo"
Dojo Admin
**Say "Thanks" by clicking the "heart" in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
**You can update your Dojo Community name and avatar by clicking on your avatar then the "My Profile" button.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
- 10.6K All Categories
- APAC User Group
- 12 Welcome
- 36 Domo News
- 9.6K Using Domo
- 1.9K Dataflows
- 2.4K Card Building
- 2.2K Ideas Exchange
- 1.2K Connectors
- 338 Workbench
- 250 Domo Best Practices
- 11 Domo Certification
- 460 Domo Developer
- 47 Domo Everywhere
- 100 Apps
- 703 New to Domo
- 84 Dojo
- Domopalooza
- 1.1K 日本支部
- 4 道場-日本支部へようこそ
- 22 お知らせ
- 62 Kowaza
- 295 仲間に相談
- 649 ひらめき共有