-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use python instead of python-experimental for py client
- Loading branch information
Showing
94 changed files
with
5,409 additions
and
5,636 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 8 additions & 10 deletions
18
...imental_client_template/README.handlebars → ..._client_urllib3_templates/README.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
openapi/python_client_urllib3_templates/README_common.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
```python | ||
{{#apiInfo}}{{#apis}}{{#-last}}{{#hasHttpSignatureMethods}}import datetime{{/hasHttpSignatureMethods}}{{/-last}}{{/apis}}{{/apiInfo}} | ||
import time | ||
import {{{packageName}}} | ||
from pprint import pprint | ||
{{#apiInfo}} | ||
{{#apis}} | ||
{{#-first}} | ||
from {{apiPackage}} import {{classFilename}} | ||
{{#imports}} | ||
{{{import}}} | ||
{{/imports}} | ||
{{#operations}} | ||
{{#operation}} | ||
{{#-first}} | ||
{{> python_doc_auth_partial}} | ||
|
||
# Enter a context with an instance of the API client | ||
with {{{packageName}}}.ApiClient(configuration) as api_client: | ||
# Create an instance of the API class | ||
api_instance = {{classFilename}}.{{{classname}}}(api_client) | ||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} | ||
{{/allParams}} | ||
|
||
try: | ||
{{#summary}} # {{{.}}} | ||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} | ||
pprint(api_response){{/returnType}} | ||
except {{{packageName}}}.ApiException as e: | ||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) | ||
{{/-first}} | ||
{{/operation}} | ||
{{/operations}} | ||
{{/-first}} | ||
{{/apis}} | ||
{{/apiInfo}} | ||
``` | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *{{basePath}}* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} | ||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} | ||
|
||
## Documentation For Models | ||
|
||
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) | ||
{{/model}}{{/models}} | ||
|
||
## Documentation For Authorization | ||
|
||
{{^authMethods}} | ||
All endpoints do not require authorization. | ||
{{/authMethods}} | ||
{{#authMethods}} | ||
{{#last}} Authentication schemes defined for the API:{{/last}} | ||
## {{{name}}} | ||
|
||
{{#isApiKey}} | ||
- **Type**: API key | ||
- **API key parameter name**: {{{keyParamName}}} | ||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} | ||
{{/isApiKey}} | ||
{{#isBasic}} | ||
{{#isBasicBasic}} | ||
- **Type**: HTTP basic authentication | ||
{{/isBasicBasic}} | ||
{{#isBasicBearer}} | ||
- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} | ||
{{/isBasicBearer}} | ||
{{#isHttpSignature}} | ||
- **Type**: HTTP signature authentication | ||
{{/isHttpSignature}} | ||
{{/isBasic}} | ||
{{#isOAuth}} | ||
- **Type**: OAuth | ||
- **Flow**: {{{flow}}} | ||
- **Authorization URL**: {{{authorizationUrl}}} | ||
- **Scopes**: {{^scopes}}N/A{{/scopes}} | ||
{{#scopes}} - **{{{scope}}}**: {{{description}}} | ||
{{/scopes}} | ||
{{/isOAuth}} | ||
|
||
{{/authMethods}} | ||
|
||
## Author | ||
|
||
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} | ||
{{/-last}}{{/apis}}{{/apiInfo}} | ||
|
||
## Notes for Large OpenAPI documents | ||
If the OpenAPI document is large, imports in {{{packageName}}}.apis and {{{packageName}}}.models may fail with a | ||
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: | ||
|
||
Solution 1: | ||
Use specific imports for apis and models like: | ||
- `from {{{packageName}}}.api.default_api import DefaultApi` | ||
- `from {{{packageName}}}.model.pet import Pet` | ||
|
||
Solution 2: | ||
Before importing the package, adjust the maximum recursion limit as shown below: | ||
``` | ||
import sys | ||
sys.setrecursionlimit(1500) | ||
import {{{packageName}}} | ||
from {{{packageName}}}.apis import * | ||
from {{{packageName}}}.models import * | ||
``` |
27 changes: 13 additions & 14 deletions
27
...nt_template/README_onlypackage.handlebars → ...ib3_templates/README_onlypackage.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
...al_client_template/__init__api.handlebars → ...nt_urllib3_templates/__init__api.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{{#with apiInfo}} | ||
{{#each apis}} | ||
{{#if @first}} | ||
{{#apiInfo}} | ||
{{#apis}} | ||
{{#-first}} | ||
# do not import all apis into this module because that uses a lot of memory and stack frames | ||
# if you need the ability to import all apis from one package, import them with | ||
# from {{packageName}}.apis import {{classname}} | ||
{{/if}} | ||
{{/each}} | ||
{{/with}} | ||
{{/-first}} | ||
{{/apis}} | ||
{{/apiInfo}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
...client_template/__init__models.handlebars → ...urllib3_templates/__init__models.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
# coding: utf-8 | ||
|
||
# flake8: noqa | ||
|
||
# import all models into this package | ||
# if you have many models here with many references from one model to another this may | ||
# raise a RecursionError | ||
# to avoid this, import only the models that you directly need like: | ||
# from from {{packageName}}.{{modelPackage}}.pet import Pet | ||
# from from {{modelPackage}}.pet import Pet | ||
# or import this package, but before doing it, use: | ||
# import sys | ||
# sys.setrecursionlimit(n) | ||
|
||
{{#each models}} | ||
{{#with model}} | ||
from {{packageName}}.{{modelPackage}}.{{classFilename}} import {{classname}} | ||
{{/with}} | ||
{{/each}} | ||
{{#models}} | ||
{{#model}} | ||
from {{modelPackage}}.{{classFilename}} import {{classname}} | ||
{{/model}} | ||
{{/models}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.