APIs & Domo Developer

APIs & Domo Developer

CodeEngine: JSONDecodeError

Hi All,

I'm looking to query datasets from within code engine (a similar function exists but avoiding calling codeengine within codeengine to use that function)

  1. def new_users(dataSetId="insert"):
  2. url = f"https://api.domo.com/v1/datasets/query/execute/{dataSetId}"
  3. body = {"sql": "SELECT * FROM 'table_name'"}
  4. response = codeengine.send_request('post', url,body=body,headers=None, contentType="application/json")
  5. return response

The working pydomo equivilent is

  1. from pydomo import Domo
  2. domo = Domo(client_id,client_secret,url)
  3. domo.datasets.query(table,query)

PyDomo throws error in code engine.

Documentation:
https://developer.domo.com/portal/52fd0777839f4-query-a-data-set

https://developer.domo.com/portal/35115c5c48927-datasets-api

Error(s) returned:

  1. Pydomo:
  2.  
  3. JSONDecodeError at line 29 of /var/task/app.py: Expecting value: line 1 column 1 (char 0)
  4. ModuleNotFoundError at line 62 of /var/task/executor.py: No module named 'pydomo
  5.  
  6. Code Engine:
  7. JSONDecodeError at line 41 of /var/task/executor.py: Expecting value: line 1 column 1 (char 0)

Code Engine Configuration

Input: TEXT
Output: OBEJECT

Tagged:

Answers

  • Contributor

    Have you tried removing the import statement? Code Engine is weird and it might just be built in and allow you to call that Domo function without the import statement. Otherwise, you can use the requests package instead the Python SDK.

    Was this comment helpful? Click Agree or Like below.
    Did this comment solve your problem? Accept it as the solution!

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In