Skip to content

Instantly share code, notes, and snippets.

@ag-chirag
Created September 24, 2024 03:12
Show Gist options
  • Save ag-chirag/f35b16e152e527bc05c25c1ca57c67bf to your computer and use it in GitHub Desktop.
Save ag-chirag/f35b16e152e527bc05c25c1ca57c67bf to your computer and use it in GitHub Desktop.
Simple Client to call DataCommons NL API
class DataCommonsClient:
def __init__(self):
self.data_fetcher = dg.DataCommons(api_key=DC_API_KEY)
def call_dc(self, questions: list[str]) -> dict[str, dg.base.DataCommonsCall]:
try:
q2resp = self.data_fetcher.calln(questions, self.data_fetcher.point)
except Exception as e:
logging.warning(e)
q2resp = {}
pass
return q2resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment