Skip to content

Commit 672973a

Browse files
committed
separate template for httpx api_client
1 parent fd1099c commit 672973a

97 files changed

Lines changed: 1013 additions & 99 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ public void processOpts() {
327327
supportingFiles.add(new SupportingFile("__init__.mustache", testFolder, "__init__.py"));
328328
}
329329

330-
supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
331330
supportingFiles.add(new SupportingFile("api_response.mustache", packagePath(), "api_response.py"));
332331

333332
if ("asyncio".equals(getLibrary())) {
@@ -339,13 +338,15 @@ public void processOpts() {
339338
additionalProperties.put("tornado", "true");
340339
} else if ("httpx".equals(getLibrary())) {
341340
supportingFiles.add(new SupportingFile("httpx/rest.mustache", packagePath(), "rest.py"));
341+
supportingFiles.add(new SupportingFile("httpx/api_client.mustache", packagePath(), "api_client.py"));
342342
additionalProperties.put("async", "true");
343343
additionalProperties.put("httpx", "true");
344344
} else if ("httpx-sync".equals(getLibrary())) {
345345
supportingFiles.add(new SupportingFile("httpx/rest.mustache", packagePath(), "rest.py"));
346346
additionalProperties.put("httpx", "true");
347347
} else {
348348
supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py"));
349+
supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
349350
}
350351

351352
modelPackage = this.packageName + "." + modelPackage;

modules/openapi-generator/src/main/resources/python/api_client.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ class ApiClient:
101101
return self
102102

103103
def __exit__(self, exc_type, exc_value, traceback):
104-
self.close()
105-
106-
def close(self):
107-
self.rest_client.close()
104+
pass
108105
{{/async}}
109106

110107
@property

0 commit comments

Comments
 (0)