Skip to content

Commit

Permalink
[python] Add back __enter__ and __exit__ methods for non asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
ykitamura-mdsol committed Nov 3, 2023
1 parent 171cc67 commit 6304aee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ class ApiClient:
async def close(self):
await self.rest_client.close()
{{/asyncio}}
{{^asyncio}}
def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
pass
{{/asyncio}}

@property
def user_agent(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def __init__(
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
pass

@property
def user_agent(self):
Expand Down
5 changes: 5 additions & 0 deletions samples/client/echo_api/python/openapi_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def __init__(
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
pass

@property
def user_agent(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def __init__(
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
pass

@property
def user_agent(self):
Expand Down

0 comments on commit 6304aee

Please sign in to comment.