pulp_python_client 3.4.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/docs/ContentPackagesApi.md +4 -0
- data/docs/RepositoryAddRemoveContent.md +2 -2
- data/lib/pulp_python_client/api/content_packages_api.rb +7 -1
- data/lib/pulp_python_client/api/distributions_pypi_api.rb +1 -1
- data/lib/pulp_python_client/api/publications_pypi_api.rb +1 -1
- data/lib/pulp_python_client/api/pypi_api.rb +1 -1
- data/lib/pulp_python_client/api/pypi_legacy_api.rb +1 -1
- data/lib/pulp_python_client/api/pypi_metadata_api.rb +1 -1
- data/lib/pulp_python_client/api/pypi_simple_api.rb +1 -1
- data/lib/pulp_python_client/api/remotes_python_api.rb +1 -1
- data/lib/pulp_python_client/api/repositories_python_api.rb +1 -1
- data/lib/pulp_python_client/api/repositories_python_versions_api.rb +1 -1
- data/lib/pulp_python_client/api_client.rb +12 -8
- data/lib/pulp_python_client/api_error.rb +1 -1
- data/lib/pulp_python_client/configuration.rb +8 -1
- data/lib/pulp_python_client/models/async_operation_response.rb +1 -1
- data/lib/pulp_python_client/models/content_summary.rb +1 -1
- data/lib/pulp_python_client/models/content_summary_response.rb +1 -1
- data/lib/pulp_python_client/models/exclude_platforms_enum.rb +1 -1
- data/lib/pulp_python_client/models/package_metadata_response.rb +1 -1
- data/lib/pulp_python_client/models/package_types_enum.rb +1 -1
- data/lib/pulp_python_client/models/package_upload.rb +1 -1
- data/lib/pulp_python_client/models/package_upload_task_response.rb +1 -1
- data/lib/pulp_python_client/models/paginated_repository_version_response_list.rb +1 -1
- data/lib/pulp_python_client/models/paginatedpython_python_distribution_response_list.rb +1 -1
- data/lib/pulp_python_client/models/paginatedpython_python_package_content_response_list.rb +1 -1
- data/lib/pulp_python_client/models/paginatedpython_python_publication_response_list.rb +1 -1
- data/lib/pulp_python_client/models/paginatedpython_python_remote_response_list.rb +1 -1
- data/lib/pulp_python_client/models/paginatedpython_python_repository_response_list.rb +1 -1
- data/lib/pulp_python_client/models/patchedpython_python_distribution.rb +1 -1
- data/lib/pulp_python_client/models/patchedpython_python_remote.rb +1 -1
- data/lib/pulp_python_client/models/patchedpython_python_repository.rb +1 -1
- data/lib/pulp_python_client/models/policy_enum.rb +1 -1
- data/lib/pulp_python_client/models/python_bander_remote.rb +1 -1
- data/lib/pulp_python_client/models/python_python_distribution.rb +1 -1
- data/lib/pulp_python_client/models/python_python_distribution_response.rb +1 -1
- data/lib/pulp_python_client/models/python_python_package_content.rb +1 -1
- data/lib/pulp_python_client/models/python_python_package_content_response.rb +1 -1
- data/lib/pulp_python_client/models/python_python_publication.rb +1 -1
- data/lib/pulp_python_client/models/python_python_publication_response.rb +1 -1
- data/lib/pulp_python_client/models/python_python_remote.rb +1 -1
- data/lib/pulp_python_client/models/python_python_remote_response.rb +1 -1
- data/lib/pulp_python_client/models/python_python_repository.rb +1 -1
- data/lib/pulp_python_client/models/python_python_repository_response.rb +1 -1
- data/lib/pulp_python_client/models/repository_add_remove_content.rb +3 -3
- data/lib/pulp_python_client/models/repository_sync_url.rb +1 -1
- data/lib/pulp_python_client/models/repository_version.rb +1 -1
- data/lib/pulp_python_client/models/repository_version_response.rb +1 -1
- data/lib/pulp_python_client/models/summary_response.rb +1 -1
- data/lib/pulp_python_client/version.rb +2 -2
- data/lib/pulp_python_client.rb +1 -1
- data/pulp_python_client.gemspec +1 -1
- data/spec/api/content_packages_api_spec.rb +3 -1
- data/spec/api/distributions_pypi_api_spec.rb +1 -1
- data/spec/api/publications_pypi_api_spec.rb +1 -1
- data/spec/api/pypi_api_spec.rb +1 -1
- data/spec/api/pypi_legacy_api_spec.rb +1 -1
- data/spec/api/pypi_metadata_api_spec.rb +1 -1
- data/spec/api/pypi_simple_api_spec.rb +1 -1
- data/spec/api/remotes_python_api_spec.rb +1 -1
- data/spec/api/repositories_python_api_spec.rb +1 -1
- data/spec/api/repositories_python_versions_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/async_operation_response_spec.rb +1 -1
- data/spec/models/content_summary_response_spec.rb +1 -1
- data/spec/models/content_summary_spec.rb +1 -1
- data/spec/models/exclude_platforms_enum_spec.rb +1 -1
- data/spec/models/package_metadata_response_spec.rb +1 -1
- data/spec/models/package_types_enum_spec.rb +1 -1
- data/spec/models/package_upload_spec.rb +1 -1
- data/spec/models/package_upload_task_response_spec.rb +1 -1
- data/spec/models/paginated_repository_version_response_list_spec.rb +1 -1
- data/spec/models/paginatedpython_python_distribution_response_list_spec.rb +1 -1
- data/spec/models/paginatedpython_python_package_content_response_list_spec.rb +1 -1
- data/spec/models/paginatedpython_python_publication_response_list_spec.rb +1 -1
- data/spec/models/paginatedpython_python_remote_response_list_spec.rb +1 -1
- data/spec/models/paginatedpython_python_repository_response_list_spec.rb +1 -1
- data/spec/models/patchedpython_python_distribution_spec.rb +1 -1
- data/spec/models/patchedpython_python_remote_spec.rb +1 -1
- data/spec/models/patchedpython_python_repository_spec.rb +1 -1
- data/spec/models/policy_enum_spec.rb +1 -1
- data/spec/models/python_bander_remote_spec.rb +1 -1
- data/spec/models/python_python_distribution_response_spec.rb +1 -1
- data/spec/models/python_python_distribution_spec.rb +1 -1
- data/spec/models/python_python_package_content_response_spec.rb +1 -1
- data/spec/models/python_python_package_content_spec.rb +1 -1
- data/spec/models/python_python_publication_response_spec.rb +1 -1
- data/spec/models/python_python_publication_spec.rb +1 -1
- data/spec/models/python_python_remote_response_spec.rb +1 -1
- data/spec/models/python_python_remote_spec.rb +1 -1
- data/spec/models/python_python_repository_response_spec.rb +1 -1
- data/spec/models/python_python_repository_spec.rb +1 -1
- data/spec/models/repository_add_remove_content_spec.rb +1 -1
- data/spec/models/repository_sync_url_spec.rb +1 -1
- data/spec/models/repository_version_response_spec.rb +1 -1
- data/spec/models/repository_version_spec.rb +1 -1
- data/spec/models/summary_response_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +33 -196
- data/build/lib/pulpcore/__init__.py +0 -2
- data/build/lib/pulpcore/client/__init__.py +0 -2
- data/build/lib/pulpcore/client/pulp_python/__init__.py +0 -75
- data/build/lib/pulpcore/client/pulp_python/api/__init__.py +0 -15
- data/build/lib/pulpcore/client/pulp_python/api/content_packages_api.py +0 -626
- data/build/lib/pulpcore/client/pulp_python/api/distributions_pypi_api.py +0 -830
- data/build/lib/pulpcore/client/pulp_python/api/publications_pypi_api.py +0 -566
- data/build/lib/pulpcore/client/pulp_python/api/pypi_api.py +0 -162
- data/build/lib/pulpcore/client/pulp_python/api/pypi_legacy_api.py +0 -185
- data/build/lib/pulpcore/client/pulp_python/api/pypi_metadata_api.py +0 -171
- data/build/lib/pulpcore/client/pulp_python/api/pypi_simple_api.py +0 -434
- data/build/lib/pulpcore/client/pulp_python/api/remotes_python_api.py +0 -972
- data/build/lib/pulpcore/client/pulp_python/api/repositories_python_api.py +0 -1063
- data/build/lib/pulpcore/client/pulp_python/api/repositories_python_versions_api.py +0 -614
- data/build/lib/pulpcore/client/pulp_python/api_client.py +0 -667
- data/build/lib/pulpcore/client/pulp_python/configuration.py +0 -427
- data/build/lib/pulpcore/client/pulp_python/exceptions.py +0 -121
- data/build/lib/pulpcore/client/pulp_python/models/__init__.py +0 -51
- data/build/lib/pulpcore/client/pulp_python/models/async_operation_response.py +0 -124
- data/build/lib/pulpcore/client/pulp_python/models/content_summary.py +0 -176
- data/build/lib/pulpcore/client/pulp_python/models/content_summary_response.py +0 -176
- data/build/lib/pulpcore/client/pulp_python/models/exclude_platforms_enum.py +0 -103
- data/build/lib/pulpcore/client/pulp_python/models/package_metadata_response.py +0 -209
- data/build/lib/pulpcore/client/pulp_python/models/package_types_enum.py +0 -107
- data/build/lib/pulpcore/client/pulp_python/models/package_upload.py +0 -187
- data/build/lib/pulpcore/client/pulp_python/models/package_upload_task_response.py +0 -176
- data/build/lib/pulpcore/client/pulp_python/models/paginated_repository_version_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/paginatedpython_python_distribution_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/paginatedpython_python_package_content_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/paginatedpython_python_publication_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/paginatedpython_python_remote_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/paginatedpython_python_repository_response_list.py +0 -197
- data/build/lib/pulpcore/client/pulp_python/models/patchedpython_python_distribution.py +0 -286
- data/build/lib/pulpcore/client/pulp_python/models/patchedpython_python_remote.py +0 -823
- data/build/lib/pulpcore/client/pulp_python/models/patchedpython_python_repository.py +0 -259
- data/build/lib/pulpcore/client/pulp_python/models/policy_enum.py +0 -102
- data/build/lib/pulpcore/client/pulp_python/models/python_bander_remote.py +0 -181
- data/build/lib/pulpcore/client/pulp_python/models/python_python_distribution.py +0 -288
- data/build/lib/pulpcore/client/pulp_python/models/python_python_distribution_response.py +0 -368
- data/build/lib/pulpcore/client/pulp_python/models/python_python_package_content.py +0 -824
- data/build/lib/pulpcore/client/pulp_python/models/python_python_package_content_response.py +0 -933
- data/build/lib/pulpcore/client/pulp_python/models/python_python_publication.py +0 -149
- data/build/lib/pulpcore/client/pulp_python/models/python_python_publication_response.py +0 -231
- data/build/lib/pulpcore/client/pulp_python/models/python_python_remote.py +0 -825
- data/build/lib/pulpcore/client/pulp_python/models/python_python_remote_response.py +0 -772
- data/build/lib/pulpcore/client/pulp_python/models/python_python_repository.py +0 -260
- data/build/lib/pulpcore/client/pulp_python/models/python_python_repository_response.py +0 -366
- data/build/lib/pulpcore/client/pulp_python/models/repository_add_remove_content.py +0 -179
- data/build/lib/pulpcore/client/pulp_python/models/repository_sync_url.py +0 -151
- data/build/lib/pulpcore/client/pulp_python/models/repository_version.py +0 -123
- data/build/lib/pulpcore/client/pulp_python/models/repository_version_response.py +0 -257
- data/build/lib/pulpcore/client/pulp_python/models/summary_response.py +0 -182
- data/build/lib/pulpcore/client/pulp_python/rest.py +0 -292
- data/dist/pulp_python-client-3.4.0.tar.gz +0 -0
- data/dist/pulp_python_client-3.4.0-py3-none-any.whl +0 -0
- data/pulp_python_client.egg-info/PKG-INFO +0 -15
- data/pulp_python_client.egg-info/SOURCES.txt +0 -105
- data/pulp_python_client.egg-info/dependency_links.txt +0 -1
- data/pulp_python_client.egg-info/requires.txt +0 -4
- data/pulp_python_client.egg-info/top_level.txt +0 -1
- data/pulpcore/__init__.py +0 -2
- data/pulpcore/client/__init__.py +0 -2
- data/pulpcore/client/pulp_python/__init__.py +0 -75
- data/pulpcore/client/pulp_python/api/__init__.py +0 -15
- data/pulpcore/client/pulp_python/api/content_packages_api.py +0 -626
- data/pulpcore/client/pulp_python/api/distributions_pypi_api.py +0 -830
- data/pulpcore/client/pulp_python/api/publications_pypi_api.py +0 -566
- data/pulpcore/client/pulp_python/api/pypi_api.py +0 -162
- data/pulpcore/client/pulp_python/api/pypi_legacy_api.py +0 -185
- data/pulpcore/client/pulp_python/api/pypi_metadata_api.py +0 -171
- data/pulpcore/client/pulp_python/api/pypi_simple_api.py +0 -434
- data/pulpcore/client/pulp_python/api/remotes_python_api.py +0 -972
- data/pulpcore/client/pulp_python/api/repositories_python_api.py +0 -1063
- data/pulpcore/client/pulp_python/api/repositories_python_versions_api.py +0 -614
- data/pulpcore/client/pulp_python/api_client.py +0 -667
- data/pulpcore/client/pulp_python/configuration.py +0 -427
- data/pulpcore/client/pulp_python/exceptions.py +0 -121
- data/pulpcore/client/pulp_python/models/__init__.py +0 -51
- data/pulpcore/client/pulp_python/models/async_operation_response.py +0 -124
- data/pulpcore/client/pulp_python/models/content_summary.py +0 -176
- data/pulpcore/client/pulp_python/models/content_summary_response.py +0 -176
- data/pulpcore/client/pulp_python/models/exclude_platforms_enum.py +0 -103
- data/pulpcore/client/pulp_python/models/package_metadata_response.py +0 -209
- data/pulpcore/client/pulp_python/models/package_types_enum.py +0 -107
- data/pulpcore/client/pulp_python/models/package_upload.py +0 -187
- data/pulpcore/client/pulp_python/models/package_upload_task_response.py +0 -176
- data/pulpcore/client/pulp_python/models/paginated_repository_version_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/paginatedpython_python_distribution_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/paginatedpython_python_package_content_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/paginatedpython_python_publication_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/paginatedpython_python_remote_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/paginatedpython_python_repository_response_list.py +0 -197
- data/pulpcore/client/pulp_python/models/patchedpython_python_distribution.py +0 -286
- data/pulpcore/client/pulp_python/models/patchedpython_python_remote.py +0 -823
- data/pulpcore/client/pulp_python/models/patchedpython_python_repository.py +0 -259
- data/pulpcore/client/pulp_python/models/policy_enum.py +0 -102
- data/pulpcore/client/pulp_python/models/python_bander_remote.py +0 -181
- data/pulpcore/client/pulp_python/models/python_python_distribution.py +0 -288
- data/pulpcore/client/pulp_python/models/python_python_distribution_response.py +0 -368
- data/pulpcore/client/pulp_python/models/python_python_package_content.py +0 -824
- data/pulpcore/client/pulp_python/models/python_python_package_content_response.py +0 -933
- data/pulpcore/client/pulp_python/models/python_python_publication.py +0 -149
- data/pulpcore/client/pulp_python/models/python_python_publication_response.py +0 -231
- data/pulpcore/client/pulp_python/models/python_python_remote.py +0 -825
- data/pulpcore/client/pulp_python/models/python_python_remote_response.py +0 -772
- data/pulpcore/client/pulp_python/models/python_python_repository.py +0 -260
- data/pulpcore/client/pulp_python/models/python_python_repository_response.py +0 -366
- data/pulpcore/client/pulp_python/models/repository_add_remove_content.py +0 -179
- data/pulpcore/client/pulp_python/models/repository_sync_url.py +0 -151
- data/pulpcore/client/pulp_python/models/repository_version.py +0 -123
- data/pulpcore/client/pulp_python/models/repository_version_response.py +0 -257
- data/pulpcore/client/pulp_python/models/summary_response.py +0 -182
- data/pulpcore/client/pulp_python/rest.py +0 -292
- data/requirements.txt +0 -6
- data/setup.cfg +0 -2
- data/setup.py +0 -42
- data/test/__init__.py +0 -0
- data/test/test_async_operation_response.py +0 -54
- data/test/test_content_packages_api.py +0 -55
- data/test/test_content_summary.py +0 -70
- data/test/test_content_summary_response.py +0 -70
- data/test/test_distributions_pypi_api.py +0 -76
- data/test/test_exclude_platforms_enum.py +0 -52
- data/test/test_package_metadata_response.py +0 -60
- data/test/test_package_types_enum.py +0 -52
- data/test/test_package_upload.py +0 -57
- data/test/test_package_upload_task_response.py +0 -58
- data/test/test_paginated_repository_version_response_list.py +0 -64
- data/test/test_paginatedpython_python_distribution_response_list.py +0 -68
- data/test/test_paginatedpython_python_package_content_response_list.py +0 -88
- data/test/test_paginatedpython_python_publication_response_list.py +0 -65
- data/test/test_paginatedpython_python_remote_response_list.py +0 -88
- data/test/test_paginatedpython_python_repository_response_list.py +0 -68
- data/test/test_patchedpython_python_distribution.py +0 -59
- data/test/test_patchedpython_python_remote.py +0 -84
- data/test/test_patchedpython_python_repository.py +0 -58
- data/test/test_policy_enum.py +0 -52
- data/test/test_publications_pypi_api.py +0 -62
- data/test/test_pypi_api.py +0 -41
- data/test/test_pypi_legacy_api.py +0 -41
- data/test/test_pypi_metadata_api.py +0 -41
- data/test/test_pypi_simple_api.py +0 -55
- data/test/test_python_bander_remote.py +0 -57
- data/test/test_python_python_distribution.py +0 -61
- data/test/test_python_python_distribution_response.py +0 -64
- data/test/test_python_python_package_content.py +0 -79
- data/test/test_python_python_package_content_response.py +0 -82
- data/test/test_python_python_publication.py +0 -54
- data/test/test_python_python_publication_response.py +0 -59
- data/test/test_python_python_remote.py +0 -86
- data/test/test_python_python_remote_response.py +0 -84
- data/test/test_python_python_repository.py +0 -59
- data/test/test_python_python_repository_response.py +0 -63
- data/test/test_remotes_python_api.py +0 -83
- data/test/test_repositories_python_api.py +0 -90
- data/test/test_repositories_python_versions_api.py +0 -61
- data/test/test_repository_add_remove_content.py +0 -59
- data/test/test_repository_sync_url.py +0 -54
- data/test/test_repository_version.py +0 -53
- data/test/test_repository_version_response.py +0 -58
- data/test/test_summary_response.py +0 -58
- data/test-requirements.txt +0 -3
- data/tox.ini +0 -9
@@ -1,667 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
"""
|
3
|
-
Pulp 3 API
|
4
|
-
|
5
|
-
Fetch, Upload, Organize, and Distribute Software Packages # noqa: E501
|
6
|
-
|
7
|
-
The version of the OpenAPI document: v3
|
8
|
-
Contact: pulp-list@redhat.com
|
9
|
-
Generated by: https://openapi-generator.tech
|
10
|
-
"""
|
11
|
-
|
12
|
-
from __future__ import absolute_import
|
13
|
-
|
14
|
-
import atexit
|
15
|
-
import datetime
|
16
|
-
from dateutil.parser import parse
|
17
|
-
import json
|
18
|
-
import mimetypes
|
19
|
-
from multiprocessing.pool import ThreadPool
|
20
|
-
import os
|
21
|
-
import re
|
22
|
-
import tempfile
|
23
|
-
|
24
|
-
# python 2 and python 3 compatibility library
|
25
|
-
import six
|
26
|
-
from six.moves.urllib.parse import quote
|
27
|
-
|
28
|
-
from pulpcore.client.pulp_python.configuration import Configuration
|
29
|
-
import pulpcore.client.pulp_python.models
|
30
|
-
from pulpcore.client.pulp_python import rest
|
31
|
-
from pulpcore.client.pulp_python.exceptions import ApiValueError, ApiException
|
32
|
-
|
33
|
-
|
34
|
-
class ApiClient(object):
|
35
|
-
"""Generic API client for OpenAPI client library builds.
|
36
|
-
|
37
|
-
OpenAPI generic API client. This client handles the client-
|
38
|
-
server communication, and is invariant across implementations. Specifics of
|
39
|
-
the methods and models for each application are generated from the OpenAPI
|
40
|
-
templates.
|
41
|
-
|
42
|
-
NOTE: This class is auto generated by OpenAPI Generator.
|
43
|
-
Ref: https://openapi-generator.tech
|
44
|
-
Do not edit the class manually.
|
45
|
-
|
46
|
-
:param configuration: .Configuration object for this client
|
47
|
-
:param header_name: a header to pass when making calls to the API.
|
48
|
-
:param header_value: a header value to pass when making calls to
|
49
|
-
the API.
|
50
|
-
:param cookie: a cookie to include in the header when making calls
|
51
|
-
to the API
|
52
|
-
:param pool_threads: The number of threads to use for async requests
|
53
|
-
to the API. More threads means more concurrent API requests.
|
54
|
-
"""
|
55
|
-
|
56
|
-
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
|
57
|
-
NATIVE_TYPES_MAPPING = {
|
58
|
-
'int': int,
|
59
|
-
'long': int if six.PY3 else long, # noqa: F821
|
60
|
-
'float': float,
|
61
|
-
'str': str,
|
62
|
-
'bool': bool,
|
63
|
-
'date': datetime.date,
|
64
|
-
'datetime': datetime.datetime,
|
65
|
-
'object': object,
|
66
|
-
}
|
67
|
-
_pool = None
|
68
|
-
|
69
|
-
def __init__(self, configuration=None, header_name=None, header_value=None,
|
70
|
-
cookie=None, pool_threads=1):
|
71
|
-
if configuration is None:
|
72
|
-
configuration = Configuration.get_default_copy()
|
73
|
-
self.configuration = configuration
|
74
|
-
self.pool_threads = pool_threads
|
75
|
-
|
76
|
-
self.rest_client = rest.RESTClientObject(configuration)
|
77
|
-
self.default_headers = {}
|
78
|
-
if header_name is not None:
|
79
|
-
self.default_headers[header_name] = header_value
|
80
|
-
self.cookie = cookie
|
81
|
-
# Set default User-Agent.
|
82
|
-
self.user_agent = 'OpenAPI-Generator/3.4.0/python'
|
83
|
-
self.client_side_validation = configuration.client_side_validation
|
84
|
-
|
85
|
-
def __enter__(self):
|
86
|
-
return self
|
87
|
-
|
88
|
-
def __exit__(self, exc_type, exc_value, traceback):
|
89
|
-
self.close()
|
90
|
-
|
91
|
-
def close(self):
|
92
|
-
if self._pool:
|
93
|
-
self._pool.close()
|
94
|
-
self._pool.join()
|
95
|
-
self._pool = None
|
96
|
-
if hasattr(atexit, 'unregister'):
|
97
|
-
atexit.unregister(self.close)
|
98
|
-
|
99
|
-
@property
|
100
|
-
def pool(self):
|
101
|
-
"""Create thread pool on first request
|
102
|
-
avoids instantiating unused threadpool for blocking clients.
|
103
|
-
"""
|
104
|
-
if self._pool is None:
|
105
|
-
atexit.register(self.close)
|
106
|
-
self._pool = ThreadPool(self.pool_threads)
|
107
|
-
return self._pool
|
108
|
-
|
109
|
-
@property
|
110
|
-
def user_agent(self):
|
111
|
-
"""User agent for this API client"""
|
112
|
-
return self.default_headers['User-Agent']
|
113
|
-
|
114
|
-
@user_agent.setter
|
115
|
-
def user_agent(self, value):
|
116
|
-
self.default_headers['User-Agent'] = value
|
117
|
-
|
118
|
-
def set_default_header(self, header_name, header_value):
|
119
|
-
self.default_headers[header_name] = header_value
|
120
|
-
|
121
|
-
def __call_api(
|
122
|
-
self, resource_path, method, path_params=None,
|
123
|
-
query_params=None, header_params=None, body=None, post_params=None,
|
124
|
-
files=None, response_type=None, auth_settings=None,
|
125
|
-
_return_http_data_only=None, collection_formats=None,
|
126
|
-
_preload_content=True, _request_timeout=None, _host=None):
|
127
|
-
|
128
|
-
config = self.configuration
|
129
|
-
|
130
|
-
# header parameters
|
131
|
-
header_params = header_params or {}
|
132
|
-
header_params.update(self.default_headers)
|
133
|
-
if self.cookie:
|
134
|
-
header_params['Cookie'] = self.cookie
|
135
|
-
if header_params:
|
136
|
-
header_params = self.sanitize_for_serialization(header_params)
|
137
|
-
header_params = dict(self.parameters_to_tuples(header_params,
|
138
|
-
collection_formats))
|
139
|
-
|
140
|
-
# path parameters
|
141
|
-
if path_params:
|
142
|
-
path_params = self.sanitize_for_serialization(path_params)
|
143
|
-
path_params = self.parameters_to_tuples(path_params,
|
144
|
-
collection_formats)
|
145
|
-
for k, v in path_params:
|
146
|
-
# specified safe chars, encode everything
|
147
|
-
resource_path = resource_path.replace(
|
148
|
-
'{%s}' % k,
|
149
|
-
quote(str(v), safe=config.safe_chars_for_path_param)
|
150
|
-
)
|
151
|
-
|
152
|
-
# query parameters
|
153
|
-
if query_params:
|
154
|
-
query_params = self.sanitize_for_serialization(query_params)
|
155
|
-
query_params = self.parameters_to_tuples(query_params,
|
156
|
-
collection_formats)
|
157
|
-
|
158
|
-
# post parameters
|
159
|
-
if post_params or files:
|
160
|
-
post_params = post_params if post_params else []
|
161
|
-
post_params = self.sanitize_for_serialization(post_params)
|
162
|
-
post_params = self.parameters_to_tuples(post_params,
|
163
|
-
collection_formats)
|
164
|
-
post_params.extend(self.files_parameters(files))
|
165
|
-
|
166
|
-
# auth setting
|
167
|
-
self.update_params_for_auth(header_params, query_params, auth_settings)
|
168
|
-
|
169
|
-
# body
|
170
|
-
if body:
|
171
|
-
body = self.sanitize_for_serialization(body)
|
172
|
-
|
173
|
-
# request url
|
174
|
-
if _host is None:
|
175
|
-
url = self.configuration.host + resource_path
|
176
|
-
else:
|
177
|
-
# use server/host defined in path or operation instead
|
178
|
-
url = _host + resource_path
|
179
|
-
|
180
|
-
try:
|
181
|
-
# perform request and return response
|
182
|
-
response_data = self.request(
|
183
|
-
method, url, query_params=query_params, headers=header_params,
|
184
|
-
post_params=post_params, body=body,
|
185
|
-
_preload_content=_preload_content,
|
186
|
-
_request_timeout=_request_timeout)
|
187
|
-
except ApiException as e:
|
188
|
-
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
189
|
-
raise e
|
190
|
-
|
191
|
-
content_type = response_data.getheader('content-type')
|
192
|
-
|
193
|
-
self.last_response = response_data
|
194
|
-
|
195
|
-
return_data = response_data
|
196
|
-
|
197
|
-
if not _preload_content:
|
198
|
-
return return_data
|
199
|
-
|
200
|
-
if six.PY3 and response_type not in ["file", "bytes"]:
|
201
|
-
match = None
|
202
|
-
if content_type is not None:
|
203
|
-
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
204
|
-
encoding = match.group(1) if match else "utf-8"
|
205
|
-
response_data.data = response_data.data.decode(encoding)
|
206
|
-
|
207
|
-
# deserialize response data
|
208
|
-
if response_type:
|
209
|
-
return_data = self.deserialize(response_data, response_type)
|
210
|
-
else:
|
211
|
-
return_data = None
|
212
|
-
|
213
|
-
if _return_http_data_only:
|
214
|
-
return (return_data)
|
215
|
-
else:
|
216
|
-
return (return_data, response_data.status,
|
217
|
-
response_data.getheaders())
|
218
|
-
|
219
|
-
def sanitize_for_serialization(self, obj):
|
220
|
-
"""Builds a JSON POST object.
|
221
|
-
|
222
|
-
If obj is None, return None.
|
223
|
-
If obj is str, int, long, float, bool, return directly.
|
224
|
-
If obj is datetime.datetime, datetime.date
|
225
|
-
convert to string in iso8601 format.
|
226
|
-
If obj is list, sanitize each element in the list.
|
227
|
-
If obj is dict, return the dict.
|
228
|
-
If obj is OpenAPI model, return the properties dict.
|
229
|
-
|
230
|
-
:param obj: The data to serialize.
|
231
|
-
:return: The serialized form of data.
|
232
|
-
"""
|
233
|
-
if obj is None:
|
234
|
-
return None
|
235
|
-
elif isinstance(obj, self.PRIMITIVE_TYPES):
|
236
|
-
return obj
|
237
|
-
elif isinstance(obj, list):
|
238
|
-
return [self.sanitize_for_serialization(sub_obj)
|
239
|
-
for sub_obj in obj]
|
240
|
-
elif isinstance(obj, tuple):
|
241
|
-
return tuple(self.sanitize_for_serialization(sub_obj)
|
242
|
-
for sub_obj in obj)
|
243
|
-
elif isinstance(obj, (datetime.datetime, datetime.date)):
|
244
|
-
return obj.isoformat()
|
245
|
-
|
246
|
-
if isinstance(obj, dict):
|
247
|
-
obj_dict = obj
|
248
|
-
else:
|
249
|
-
# Convert model obj to dict except
|
250
|
-
# attributes `openapi_types`, `attribute_map`
|
251
|
-
# and attributes which value is not None.
|
252
|
-
# Convert attribute name to json key in
|
253
|
-
# model definition for request.
|
254
|
-
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
|
255
|
-
for attr, _ in six.iteritems(obj.openapi_types)
|
256
|
-
if getattr(obj, attr) is not None}
|
257
|
-
|
258
|
-
return {key: self.sanitize_for_serialization(val)
|
259
|
-
for key, val in six.iteritems(obj_dict)}
|
260
|
-
|
261
|
-
def deserialize(self, response, response_type):
|
262
|
-
"""Deserializes response into an object.
|
263
|
-
|
264
|
-
:param response: RESTResponse object to be deserialized.
|
265
|
-
:param response_type: class literal for
|
266
|
-
deserialized object, or string of class name.
|
267
|
-
|
268
|
-
:return: deserialized object.
|
269
|
-
"""
|
270
|
-
# handle file downloading
|
271
|
-
# save response body into a tmp file and return the instance
|
272
|
-
if response_type == "file":
|
273
|
-
return self.__deserialize_file(response)
|
274
|
-
|
275
|
-
# fetch data from response object
|
276
|
-
try:
|
277
|
-
data = json.loads(response.data)
|
278
|
-
except ValueError:
|
279
|
-
data = response.data
|
280
|
-
|
281
|
-
return self.__deserialize(data, response_type)
|
282
|
-
|
283
|
-
def __deserialize(self, data, klass):
|
284
|
-
"""Deserializes dict, list, str into an object.
|
285
|
-
|
286
|
-
:param data: dict, list or str.
|
287
|
-
:param klass: class literal, or string of class name.
|
288
|
-
|
289
|
-
:return: object.
|
290
|
-
"""
|
291
|
-
if data is None:
|
292
|
-
return None
|
293
|
-
|
294
|
-
if type(klass) == str:
|
295
|
-
if klass.startswith('list['):
|
296
|
-
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
|
297
|
-
return [self.__deserialize(sub_data, sub_kls)
|
298
|
-
for sub_data in data]
|
299
|
-
|
300
|
-
if klass.startswith('dict('):
|
301
|
-
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
|
302
|
-
return {k: self.__deserialize(v, sub_kls)
|
303
|
-
for k, v in six.iteritems(data)}
|
304
|
-
|
305
|
-
# convert str to class
|
306
|
-
if klass in self.NATIVE_TYPES_MAPPING:
|
307
|
-
klass = self.NATIVE_TYPES_MAPPING[klass]
|
308
|
-
else:
|
309
|
-
klass = getattr(pulpcore.client.pulp_python.models, klass)
|
310
|
-
|
311
|
-
if klass in self.PRIMITIVE_TYPES:
|
312
|
-
return self.__deserialize_primitive(data, klass)
|
313
|
-
elif klass == object:
|
314
|
-
return self.__deserialize_object(data)
|
315
|
-
elif klass == datetime.date:
|
316
|
-
return self.__deserialize_date(data)
|
317
|
-
elif klass == datetime.datetime:
|
318
|
-
return self.__deserialize_datetime(data)
|
319
|
-
else:
|
320
|
-
return self.__deserialize_model(data, klass)
|
321
|
-
|
322
|
-
def call_api(self, resource_path, method,
|
323
|
-
path_params=None, query_params=None, header_params=None,
|
324
|
-
body=None, post_params=None, files=None,
|
325
|
-
response_type=None, auth_settings=None, async_req=None,
|
326
|
-
_return_http_data_only=None, collection_formats=None,
|
327
|
-
_preload_content=True, _request_timeout=None, _host=None):
|
328
|
-
"""Makes the HTTP request (synchronous) and returns deserialized data.
|
329
|
-
|
330
|
-
To make an async_req request, set the async_req parameter.
|
331
|
-
|
332
|
-
:param resource_path: Path to method endpoint.
|
333
|
-
:param method: Method to call.
|
334
|
-
:param path_params: Path parameters in the url.
|
335
|
-
:param query_params: Query parameters in the url.
|
336
|
-
:param header_params: Header parameters to be
|
337
|
-
placed in the request header.
|
338
|
-
:param body: Request body.
|
339
|
-
:param post_params dict: Request post form parameters,
|
340
|
-
for `application/x-www-form-urlencoded`, `multipart/form-data`.
|
341
|
-
:param auth_settings list: Auth Settings names for the request.
|
342
|
-
:param response: Response data type.
|
343
|
-
:param files dict: key -> filename, value -> filepath,
|
344
|
-
for `multipart/form-data`.
|
345
|
-
:param async_req bool: execute request asynchronously
|
346
|
-
:param _return_http_data_only: response data without head status code
|
347
|
-
and headers
|
348
|
-
:param collection_formats: dict of collection formats for path, query,
|
349
|
-
header, and post parameters.
|
350
|
-
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
351
|
-
be returned without reading/decoding response
|
352
|
-
data. Default is True.
|
353
|
-
:param _request_timeout: timeout setting for this request. If one
|
354
|
-
number provided, it will be total request
|
355
|
-
timeout. It can also be a pair (tuple) of
|
356
|
-
(connection, read) timeouts.
|
357
|
-
:return:
|
358
|
-
If async_req parameter is True,
|
359
|
-
the request will be called asynchronously.
|
360
|
-
The method will return the request thread.
|
361
|
-
If parameter async_req is False or missing,
|
362
|
-
then the method will return the response directly.
|
363
|
-
"""
|
364
|
-
if not async_req:
|
365
|
-
return self.__call_api(resource_path, method,
|
366
|
-
path_params, query_params, header_params,
|
367
|
-
body, post_params, files,
|
368
|
-
response_type, auth_settings,
|
369
|
-
_return_http_data_only, collection_formats,
|
370
|
-
_preload_content, _request_timeout, _host)
|
371
|
-
|
372
|
-
return self.pool.apply_async(self.__call_api, (resource_path,
|
373
|
-
method, path_params,
|
374
|
-
query_params,
|
375
|
-
header_params, body,
|
376
|
-
post_params, files,
|
377
|
-
response_type,
|
378
|
-
auth_settings,
|
379
|
-
_return_http_data_only,
|
380
|
-
collection_formats,
|
381
|
-
_preload_content,
|
382
|
-
_request_timeout,
|
383
|
-
_host))
|
384
|
-
|
385
|
-
def request(self, method, url, query_params=None, headers=None,
|
386
|
-
post_params=None, body=None, _preload_content=True,
|
387
|
-
_request_timeout=None):
|
388
|
-
"""Makes the HTTP request using RESTClient."""
|
389
|
-
if method == "GET":
|
390
|
-
return self.rest_client.GET(url,
|
391
|
-
query_params=query_params,
|
392
|
-
_preload_content=_preload_content,
|
393
|
-
_request_timeout=_request_timeout,
|
394
|
-
headers=headers)
|
395
|
-
elif method == "HEAD":
|
396
|
-
return self.rest_client.HEAD(url,
|
397
|
-
query_params=query_params,
|
398
|
-
_preload_content=_preload_content,
|
399
|
-
_request_timeout=_request_timeout,
|
400
|
-
headers=headers)
|
401
|
-
elif method == "OPTIONS":
|
402
|
-
return self.rest_client.OPTIONS(url,
|
403
|
-
query_params=query_params,
|
404
|
-
headers=headers,
|
405
|
-
_preload_content=_preload_content,
|
406
|
-
_request_timeout=_request_timeout)
|
407
|
-
elif method == "POST":
|
408
|
-
return self.rest_client.POST(url,
|
409
|
-
query_params=query_params,
|
410
|
-
headers=headers,
|
411
|
-
post_params=post_params,
|
412
|
-
_preload_content=_preload_content,
|
413
|
-
_request_timeout=_request_timeout,
|
414
|
-
body=body)
|
415
|
-
elif method == "PUT":
|
416
|
-
return self.rest_client.PUT(url,
|
417
|
-
query_params=query_params,
|
418
|
-
headers=headers,
|
419
|
-
post_params=post_params,
|
420
|
-
_preload_content=_preload_content,
|
421
|
-
_request_timeout=_request_timeout,
|
422
|
-
body=body)
|
423
|
-
elif method == "PATCH":
|
424
|
-
return self.rest_client.PATCH(url,
|
425
|
-
query_params=query_params,
|
426
|
-
headers=headers,
|
427
|
-
post_params=post_params,
|
428
|
-
_preload_content=_preload_content,
|
429
|
-
_request_timeout=_request_timeout,
|
430
|
-
body=body)
|
431
|
-
elif method == "DELETE":
|
432
|
-
return self.rest_client.DELETE(url,
|
433
|
-
query_params=query_params,
|
434
|
-
headers=headers,
|
435
|
-
_preload_content=_preload_content,
|
436
|
-
_request_timeout=_request_timeout,
|
437
|
-
body=body)
|
438
|
-
else:
|
439
|
-
raise ApiValueError(
|
440
|
-
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
441
|
-
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
442
|
-
)
|
443
|
-
|
444
|
-
def parameters_to_tuples(self, params, collection_formats):
|
445
|
-
"""Get parameters as list of tuples, formatting collections.
|
446
|
-
|
447
|
-
:param params: Parameters as dict or list of two-tuples
|
448
|
-
:param dict collection_formats: Parameter collection formats
|
449
|
-
:return: Parameters as list of tuples, collections formatted
|
450
|
-
"""
|
451
|
-
new_params = []
|
452
|
-
if collection_formats is None:
|
453
|
-
collection_formats = {}
|
454
|
-
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
|
455
|
-
if k in collection_formats:
|
456
|
-
collection_format = collection_formats[k]
|
457
|
-
if collection_format == 'multi':
|
458
|
-
new_params.extend((k, value) for value in v)
|
459
|
-
else:
|
460
|
-
if collection_format == 'ssv':
|
461
|
-
delimiter = ' '
|
462
|
-
elif collection_format == 'tsv':
|
463
|
-
delimiter = '\t'
|
464
|
-
elif collection_format == 'pipes':
|
465
|
-
delimiter = '|'
|
466
|
-
else: # csv is the default
|
467
|
-
delimiter = ','
|
468
|
-
new_params.append(
|
469
|
-
(k, delimiter.join(str(value) for value in v)))
|
470
|
-
else:
|
471
|
-
new_params.append((k, v))
|
472
|
-
return new_params
|
473
|
-
|
474
|
-
def files_parameters(self, files=None):
|
475
|
-
"""Builds form parameters.
|
476
|
-
|
477
|
-
:param files: File parameters.
|
478
|
-
:return: Form parameters with files.
|
479
|
-
"""
|
480
|
-
params = []
|
481
|
-
|
482
|
-
if files:
|
483
|
-
for k, v in six.iteritems(files):
|
484
|
-
if not v:
|
485
|
-
continue
|
486
|
-
file_names = v if type(v) is list else [v]
|
487
|
-
for n in file_names:
|
488
|
-
with open(n, 'rb') as f:
|
489
|
-
filename = os.path.basename(f.name)
|
490
|
-
filedata = f.read()
|
491
|
-
mimetype = (mimetypes.guess_type(filename)[0] or
|
492
|
-
'application/octet-stream')
|
493
|
-
params.append(
|
494
|
-
tuple([k, tuple([filename, filedata, mimetype])]))
|
495
|
-
|
496
|
-
return params
|
497
|
-
|
498
|
-
def select_header_accept(self, accepts):
|
499
|
-
"""Returns `Accept` based on an array of accepts provided.
|
500
|
-
|
501
|
-
:param accepts: List of headers.
|
502
|
-
:return: Accept (e.g. application/json).
|
503
|
-
"""
|
504
|
-
if not accepts:
|
505
|
-
return
|
506
|
-
|
507
|
-
accepts = [x.lower() for x in accepts]
|
508
|
-
|
509
|
-
if 'application/json' in accepts:
|
510
|
-
return 'application/json'
|
511
|
-
else:
|
512
|
-
return ', '.join(accepts)
|
513
|
-
|
514
|
-
def select_header_content_type(self, content_types):
|
515
|
-
"""Returns `Content-Type` based on an array of content_types provided.
|
516
|
-
|
517
|
-
:param content_types: List of content-types.
|
518
|
-
:return: Content-Type (e.g. application/json).
|
519
|
-
"""
|
520
|
-
if not content_types:
|
521
|
-
return 'application/json'
|
522
|
-
|
523
|
-
content_types = [x.lower() for x in content_types]
|
524
|
-
|
525
|
-
if 'application/json' in content_types or '*/*' in content_types:
|
526
|
-
return 'application/json'
|
527
|
-
else:
|
528
|
-
return content_types[0]
|
529
|
-
|
530
|
-
def update_params_for_auth(self, headers, querys, auth_settings):
|
531
|
-
"""Updates header and query params based on authentication setting.
|
532
|
-
|
533
|
-
:param headers: Header parameters dict to be updated.
|
534
|
-
:param querys: Query parameters tuple list to be updated.
|
535
|
-
:param auth_settings: Authentication setting identifiers list.
|
536
|
-
"""
|
537
|
-
if not auth_settings:
|
538
|
-
return
|
539
|
-
|
540
|
-
for auth in auth_settings:
|
541
|
-
auth_setting = self.configuration.auth_settings().get(auth)
|
542
|
-
if auth_setting:
|
543
|
-
if auth_setting['in'] == 'cookie':
|
544
|
-
headers['Cookie'] = auth_setting['value']
|
545
|
-
elif auth_setting['in'] == 'header':
|
546
|
-
headers[auth_setting['key']] = auth_setting['value']
|
547
|
-
elif auth_setting['in'] == 'query':
|
548
|
-
querys.append((auth_setting['key'], auth_setting['value']))
|
549
|
-
else:
|
550
|
-
raise ApiValueError(
|
551
|
-
'Authentication token must be in `query` or `header`'
|
552
|
-
)
|
553
|
-
|
554
|
-
def __deserialize_file(self, response):
|
555
|
-
"""Deserializes body to file
|
556
|
-
|
557
|
-
Saves response body into a file in a temporary folder,
|
558
|
-
using the filename from the `Content-Disposition` header if provided.
|
559
|
-
|
560
|
-
:param response: RESTResponse.
|
561
|
-
:return: file path.
|
562
|
-
"""
|
563
|
-
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
|
564
|
-
os.close(fd)
|
565
|
-
os.remove(path)
|
566
|
-
|
567
|
-
content_disposition = response.getheader("Content-Disposition")
|
568
|
-
if content_disposition:
|
569
|
-
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
|
570
|
-
content_disposition).group(1)
|
571
|
-
path = os.path.join(os.path.dirname(path), filename)
|
572
|
-
|
573
|
-
with open(path, "wb") as f:
|
574
|
-
f.write(response.data)
|
575
|
-
|
576
|
-
return path
|
577
|
-
|
578
|
-
def __deserialize_primitive(self, data, klass):
|
579
|
-
"""Deserializes string to primitive type.
|
580
|
-
|
581
|
-
:param data: str.
|
582
|
-
:param klass: class literal.
|
583
|
-
|
584
|
-
:return: int, long, float, str, bool.
|
585
|
-
"""
|
586
|
-
try:
|
587
|
-
return klass(data)
|
588
|
-
except UnicodeEncodeError:
|
589
|
-
return six.text_type(data)
|
590
|
-
except TypeError:
|
591
|
-
return data
|
592
|
-
|
593
|
-
def __deserialize_object(self, value):
|
594
|
-
"""Return an original value.
|
595
|
-
|
596
|
-
:return: object.
|
597
|
-
"""
|
598
|
-
return value
|
599
|
-
|
600
|
-
def __deserialize_date(self, string):
|
601
|
-
"""Deserializes string to date.
|
602
|
-
|
603
|
-
:param string: str.
|
604
|
-
:return: date.
|
605
|
-
"""
|
606
|
-
try:
|
607
|
-
return parse(string).date()
|
608
|
-
except ImportError:
|
609
|
-
return string
|
610
|
-
except ValueError:
|
611
|
-
raise rest.ApiException(
|
612
|
-
status=0,
|
613
|
-
reason="Failed to parse `{0}` as date object".format(string)
|
614
|
-
)
|
615
|
-
|
616
|
-
def __deserialize_datetime(self, string):
|
617
|
-
"""Deserializes string to datetime.
|
618
|
-
|
619
|
-
The string should be in iso8601 datetime format.
|
620
|
-
|
621
|
-
:param string: str.
|
622
|
-
:return: datetime.
|
623
|
-
"""
|
624
|
-
try:
|
625
|
-
return parse(string)
|
626
|
-
except ImportError:
|
627
|
-
return string
|
628
|
-
except ValueError:
|
629
|
-
raise rest.ApiException(
|
630
|
-
status=0,
|
631
|
-
reason=(
|
632
|
-
"Failed to parse `{0}` as datetime object"
|
633
|
-
.format(string)
|
634
|
-
)
|
635
|
-
)
|
636
|
-
|
637
|
-
def __deserialize_model(self, data, klass):
|
638
|
-
"""Deserializes list or dict to model.
|
639
|
-
|
640
|
-
:param data: dict, list.
|
641
|
-
:param klass: class literal.
|
642
|
-
:return: model object.
|
643
|
-
"""
|
644
|
-
has_discriminator = False
|
645
|
-
if (hasattr(klass, 'get_real_child_model')
|
646
|
-
and klass.discriminator_value_class_map):
|
647
|
-
has_discriminator = True
|
648
|
-
|
649
|
-
if not klass.openapi_types and has_discriminator is False:
|
650
|
-
return data
|
651
|
-
|
652
|
-
kwargs = {}
|
653
|
-
if (data is not None and
|
654
|
-
klass.openapi_types is not None and
|
655
|
-
isinstance(data, (list, dict))):
|
656
|
-
for attr, attr_type in six.iteritems(klass.openapi_types):
|
657
|
-
if klass.attribute_map[attr] in data:
|
658
|
-
value = data[klass.attribute_map[attr]]
|
659
|
-
kwargs[attr] = self.__deserialize(value, attr_type)
|
660
|
-
|
661
|
-
instance = klass(**kwargs)
|
662
|
-
|
663
|
-
if has_discriminator:
|
664
|
-
klass_name = instance.get_real_child_model(data)
|
665
|
-
if klass_name:
|
666
|
-
instance = self.__deserialize(data, klass_name)
|
667
|
-
return instance
|