Skip to content

Commit a584364

Browse files
author
Raphael Krupinski
committed
🐛 Add async context manager methods to ApiClient template.
1 parent 231835e commit a584364

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lapidary/render/templates/gen/{{model.package}}/client.py.jinja

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class ApiClient(ClientBase):
2828
{% endif -%}
2929
**kwargs,
3030
)
31+
32+
async def __aenter__(self) -> 'ApiClient':
33+
await super().__aenter__()
34+
return self
35+
36+
async def __aexit__(self, __exc_type=None, __exc_value=None, __traceback=None) -> None:
37+
await super().__aexit__(__exc_type, __exc_value, __traceback)
3138
{% for func in model.client.body.methods %}
3239
{%- include 'includes/client/method_operation.py.jinja' %}
3340
{%- else %}

0 commit comments

Comments
 (0)