forked from loafle/openapi-generator-original
* fix: object serialization for multipart requests
This PR is essentially
<https://github.com/OpenAPITools/openapi-generator/pull/18140> but for
the asyncio client.
* fix: int serialization for multipart requests
urllib3 handles serializing ints in post params (ref 1), while asyncio
explicitly does not (ref 2).
ref 1: <9316764e90/src/urllib3/filepost.py (L75-L76)
>
ref 2: <https://github.com/aio-libs/aiohttp/issues/920>
* test: new fake multipart endpoint with files and body
* test: regression test for stringified body params
* fix: mypy tweak
* fix: FILES regeneration
* feat: object, int serialization for multipart reqs
Extends previous commits (and #18140) to cover the python-pydantic-v1
client as well.
* fix: use async with in test
* test: regression test for pydantic-v1-aiohttp
* test: add regression test to pydantic-v1
Also brings the second test in line with the first, patching
`urllib3.PoolManager.urlopen`
openapi-client
Echo Server API
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.1.0
- Package version: 1.0.0
- Generator version: 7.9.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen
Requirements.
Python 3.7+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import openapi_client
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import openapi_client
Tests
Execute pytest
to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: http_auth
configuration = openapi_client.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.AuthApi(api_client)
try:
# To test HTTP basic authentication
api_response = api_instance.test_auth_http_basic()
print("The response of AuthApi->test_auth_http_basic:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthApi->test_auth_http_basic: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to http://localhost:3000
Class | Method | HTTP request | Description |
---|---|---|---|
AuthApi | test_auth_http_basic | POST /auth/http/basic | To test HTTP basic authentication |
AuthApi | test_auth_http_bearer | POST /auth/http/bearer | To test HTTP bearer authentication |
BodyApi | test_binary_gif | POST /binary/gif | Test binary (gif) response body |
BodyApi | test_body_application_octetstream_binary | POST /body/application/octetstream/binary | Test body parameter(s) |
BodyApi | test_body_multipart_formdata_array_of_binary | POST /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
BodyApi | test_body_multipart_formdata_single_binary | POST /body/application/octetstream/single_binary | Test single binary in multipart mime |
BodyApi | test_echo_body_all_of_pet | POST /echo/body/allOf/Pet | Test body parameter(s) |
BodyApi | test_echo_body_free_form_object_response_string | POST /echo/body/FreeFormObject/response_string | Test free form object |
BodyApi | test_echo_body_pet | POST /echo/body/Pet | Test body parameter(s) |
BodyApi | test_echo_body_pet_response_string | POST /echo/body/Pet/response_string | Test empty response body |
BodyApi | test_echo_body_string_enum | POST /echo/body/string_enum | Test string enum response body |
BodyApi | test_echo_body_tag_response_string | POST /echo/body/Tag/response_string | Test empty json (request body) |
FormApi | test_form_integer_boolean_string | POST /form/integer/boolean/string | Test form parameter(s) |
FormApi | test_form_object_multipart | POST /form/object/multipart | Test form parameter(s) for multipart schema |
FormApi | test_form_oneof | POST /form/oneof | Test form parameter(s) for oneOf schema |
HeaderApi | test_header_integer_boolean_string_enums | GET /header/integer/boolean/string/enums | Test header parameter(s) |
PathApi | tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path | GET /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
QueryApi | test_enum_ref_string | GET /query/enum_ref_string | Test query parameter(s) |
QueryApi | test_query_datetime_date_string | GET /query/datetime/date/string | Test query parameter(s) |
QueryApi | test_query_integer_boolean_string | GET /query/integer/boolean/string | Test query parameter(s) |
QueryApi | test_query_style_deep_object_explode_true_object | GET /query/style_deepObject/explode_true/object | Test query parameter(s) |
QueryApi | test_query_style_deep_object_explode_true_object_all_of | GET /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
QueryApi | test_query_style_form_explode_false_array_integer | GET /query/style_form/explode_false/array_integer | Test query parameter(s) |
QueryApi | test_query_style_form_explode_false_array_string | GET /query/style_form/explode_false/array_string | Test query parameter(s) |
QueryApi | test_query_style_form_explode_true_array_string | GET /query/style_form/explode_true/array_string | Test query parameter(s) |
QueryApi | test_query_style_form_explode_true_object | GET /query/style_form/explode_true/object | Test query parameter(s) |
QueryApi | test_query_style_form_explode_true_object_all_of | GET /query/style_form/explode_true/object/allOf | Test query parameter(s) |
Documentation For Models
- Bird
- Category
- DataQuery
- DefaultValue
- NumberPropertiesOnly
- Pet
- Query
- StringEnumRef
- Tag
- TestFormObjectMultipartRequestMarker
- TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
- TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
Documentation For Authorization
Authentication schemes defined for the API:
http_auth
- Type: HTTP basic authentication
http_bearer_auth
- Type: Bearer authentication