Skip to content

Commit 44d4ecb

Browse files
committed
no longer catch INTERNAL_SERVER_ERROR as expected error code
1 parent 871b246 commit 44d4ecb

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
# foxops-client-python
22

33
This repository contains the Python client for the [foxops](https://github.com/roche/foxops) templating tool.
4+
5+
## Installation
6+
7+
```shell
8+
pip install foxops-client
9+
```
10+
11+
## Usage
12+
13+
```python
14+
from foxops_client import FoxOpsClient
15+
16+
client = FoxOpsClient("http://localhost:8080", "my-token")
17+
client.list_incarnations()
18+
```

src/foxops_client/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
from importlib.metadata import version
22

3+
from .client import FoxOpsClient
4+
35
__version__ = version("foxops_client")
6+
7+
__all__ = ["FoxOpsClient"]

src/foxops_client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def update_incarnation(
130130
return IncarnationWithDetails(**resp.json())
131131
case httpx.codes.NOT_FOUND:
132132
raise IncarnationDoesNotExistError(resp.json()["message"])
133-
case httpx.codes.BAD_REQUEST | httpx.codes.CONFLICT | httpx.codes.INTERNAL_SERVER_ERROR:
133+
case httpx.codes.BAD_REQUEST | httpx.codes.CONFLICT:
134134
self.log.error(f"received error from FoxOps API: {resp.status_code} {resp.headers} {resp.text}")
135135
raise FoxOpsApiError(resp.json()["message"])
136136

@@ -176,7 +176,7 @@ def create_incarnation(
176176
return True, IncarnationWithDetails(**resp.json())
177177
case httpx.codes.CREATED:
178178
return False, IncarnationWithDetails(**resp.json())
179-
case httpx.codes.BAD_REQUEST | httpx.codes.INTERNAL_SERVER_ERROR:
179+
case httpx.codes.BAD_REQUEST:
180180
self.log.error(f"received error from FoxOps API: {resp.status_code} {resp.headers} {resp.text}")
181181
raise FoxOpsApiError(resp.json()["message"])
182182

0 commit comments

Comments
 (0)