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
| 40 | |
| 41 | |
| 42 | class ApiClient(object): |
| 43 | """Generic API client for OpenAPI client library builds. |
| 44 | |
| 45 | OpenAPI generic API client. This client handles the client- |
| 46 | server communication, and is invariant across implementations. Specifics of |
| 47 | the methods and models for each application are generated from the OpenAPI |
| 48 | templates. |
| 49 | |
| 50 | NOTE: This class is auto generated by OpenAPI Generator. |
| 51 | Ref: https://openapi-generator.tech |
| 52 | Do not edit the class manually. |
| 53 | |
| 54 | :param configuration: .Configuration object for this client |
| 55 | :param header_name: a header to pass when making calls to the API. |
| 56 | :param header_value: a header value to pass when making calls to |
| 57 | the API. |
| 58 | :param cookie: a cookie to include in the header when making calls |
| 59 | to the API |
| 60 | :param pool_threads: The number of threads to use for async requests |
| 61 | to the API. More threads means more concurrent API requests. |
| 62 | """ |
| 63 | |
| 64 | _pool = None |
| 65 | |
| 66 | def __init__( |
| 67 | self, |
| 68 | configuration=None, |
| 69 | header_name=None, |
| 70 | header_value=None, |
| 71 | cookie=None, |
| 72 | pool_threads=1, |
| 73 | ): |
| 74 | if configuration is None: |
| 75 | configuration = Configuration.get_default_copy() |
| 76 | self.configuration = configuration |
| 77 | self.pool_threads = pool_threads |
| 78 | |
| 79 | self.rest_client = rest.RESTClientObject(configuration) |
| 80 | self.default_headers = {} |
| 81 | if header_name is not None: |
| 82 | self.default_headers[header_name] = header_value |
| 83 | self.cookie = cookie |
| 84 | # Set default User-Agent. |
| 85 | self.user_agent = "OpenAPI-Generator/0.1.0/python" |
| 86 | |
| 87 | def __enter__(self): |
| 88 | return self |
| 89 | |
| 90 | def __exit__(self, exc_type, exc_value, traceback): |
| 91 | self.close() |
| 92 | |
| 93 | def close(self): |
| 94 | if self._pool: |
| 95 | self._pool.close() |
| 96 | self._pool.join() |
| 97 | self._pool = None |
| 98 | if hasattr(atexit, "unregister"): |
| 99 | atexit.unregister(self.close) |