Generic API client for OpenAPI client library builds. OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the OpenAPI templates. NO
| 31 | |
| 32 | |
| 33 | class ApiClient(object): |
| 34 | """Generic API client for OpenAPI client library builds. |
| 35 | |
| 36 | OpenAPI generic API client. This client handles the client- |
| 37 | server communication, and is invariant across implementations. Specifics of |
| 38 | the methods and models for each application are generated from the OpenAPI |
| 39 | templates. |
| 40 | |
| 41 | NOTE: This class is auto generated by OpenAPI Generator. |
| 42 | Ref: https://openapi-generator.tech |
| 43 | Do not edit the class manually. |
| 44 | |
| 45 | :param configuration: .Configuration object for this client |
| 46 | :param header_name: a header to pass when making calls to the API. |
| 47 | :param header_value: a header value to pass when making calls to |
| 48 | the API. |
| 49 | :param cookie: a cookie to include in the header when making calls |
| 50 | to the API |
| 51 | :param pool_threads: The number of threads to use for async requests |
| 52 | to the API. More threads means more concurrent API requests. |
| 53 | """ |
| 54 | |
| 55 | PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types |
| 56 | NATIVE_TYPES_MAPPING = { |
| 57 | 'int': int, |
| 58 | 'long': int if six.PY3 else long, # noqa: F821 |
| 59 | 'float': float, |
| 60 | 'str': str, |
| 61 | 'bool': bool, |
| 62 | 'date': datetime.date, |
| 63 | 'datetime': datetime.datetime, |
| 64 | 'object': object, |
| 65 | } |
| 66 | _pool = None |
| 67 | |
| 68 | def __init__(self, configuration=None, header_name=None, header_value=None, |
| 69 | cookie=None, pool_threads=1): |
| 70 | if configuration is None: |
| 71 | configuration = Configuration.get_default_copy() |
| 72 | self.configuration = configuration |
| 73 | self.pool_threads = pool_threads |
| 74 | |
| 75 | self.rest_client = rest.RESTClientObject(configuration) |
| 76 | self.default_headers = {} |
| 77 | if header_name is not None: |
| 78 | self.default_headers[header_name] = header_value |
| 79 | self.cookie = cookie |
| 80 | # Set default User-Agent. |
| 81 | self.user_agent = 'OpenAPI-Generator/36.0.2/python' |
| 82 | self.client_side_validation = configuration.client_side_validation |
| 83 | |
| 84 | def __enter__(self): |
| 85 | return self |
| 86 | |
| 87 | def __exit__(self, exc_type, exc_value, traceback): |
| 88 | self.close() |
| 89 | |
| 90 | def close(self): |