Skip to content

Commit

Permalink
Fixed some ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
djspstfc committed Jul 18, 2024
1 parent 99b3b57 commit b1d2d64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions esgf-generator/esgf_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from datetime import datetime, timezone
from random import random
from typing import Any, Dict, List, Optional, TypeVar
Expand Down Expand Up @@ -203,3 +204,6 @@ def post_to_stac(data: ESGFItem) -> None:
urljoin(API_URL, f"collections/{data.collection}/items"),
content=data.json(),
)
if response.status_code >= 300:
warnings.warn(f"Failed to post {data.json()}")

2 changes: 2 additions & 0 deletions esgf-generator/esgf_generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def esgf_generator(count: int, publish: bool, delay: bool) -> None:
f"http://localhost:9050/{instance.collection}/items",
content=instance.model_dump_json(),
)
if result.status_code >= 300:
raise Exception(result.content)

click.echo(instance.model_dump_json(indent=2))

Expand Down

0 comments on commit b1d2d64

Please sign in to comment.