Skip to content

Commit

Permalink
More documentation and better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed May 20, 2022
1 parent b6ef4e4 commit 888524b
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 33 deletions.
8 changes: 7 additions & 1 deletion optimade/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"""

import click
import rich
import sys

from .client import OptimadeClient

Expand All @@ -27,7 +29,11 @@
@click.option("--base_url", default=None)
def get(use_async, filter, base_url):
client = OptimadeClient(base_urls=base_url, use_async=use_async)
client.get(filter)
try:
results = client.get(filter)
except RuntimeError:
sys.exit(1)
rich.print_json(data=results)


__all__ = ("OptimadeClient", "get")

0 comments on commit 888524b

Please sign in to comment.