This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import click | ||
import json | ||
|
||
@click.command() | ||
def cli(): | ||
click.echo("Hello, World!") | ||
from .bloomsky_api import BloomSkyAPIClient | ||
|
||
@click.command(help='Retrieve data from the BloomSky API and output it as JSON.') | ||
@click.option('--api-key', envvar='BLOOMSKY_API_KEY', | ||
help='BloomSky API key (can be set via env var BLOOMSKY_API_KEY).') | ||
@click.option('--api-url', help='Override BloomSky API endpoint URL.') | ||
@click.option('--json-indent', type=int, default=None, | ||
help='Number of spaces to indent nested JSON levels.') | ||
def cli(api_key, api_url, json_indent): | ||
client = BloomSkyAPIClient(api_key=api_key, api_url=api_url) | ||
data = client.get_data() | ||
click.echo(json.dumps(data, indent=json_indent)) | ||
|
||
if __name__ == '__main__': | ||
cli() |