Created
September 24, 2024 03:12
-
-
Save ag-chirag/f35b16e152e527bc05c25c1ca57c67bf to your computer and use it in GitHub Desktop.
Simple Client to call DataCommons NL API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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