mcp-mesh 0.7.21__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. _mcp_mesh/__init__.py +1 -1
  2. _mcp_mesh/engine/dependency_injector.py +13 -15
  3. _mcp_mesh/engine/http_wrapper.py +69 -10
  4. _mcp_mesh/engine/mesh_llm_agent.py +29 -10
  5. _mcp_mesh/engine/mesh_llm_agent_injector.py +77 -41
  6. _mcp_mesh/engine/provider_handlers/__init__.py +14 -1
  7. _mcp_mesh/engine/provider_handlers/base_provider_handler.py +114 -8
  8. _mcp_mesh/engine/provider_handlers/claude_handler.py +15 -57
  9. _mcp_mesh/engine/provider_handlers/gemini_handler.py +181 -0
  10. _mcp_mesh/engine/provider_handlers/openai_handler.py +8 -63
  11. _mcp_mesh/engine/provider_handlers/provider_handler_registry.py +16 -10
  12. _mcp_mesh/engine/response_parser.py +61 -15
  13. _mcp_mesh/engine/signature_analyzer.py +58 -68
  14. _mcp_mesh/engine/unified_mcp_proxy.py +19 -35
  15. _mcp_mesh/pipeline/__init__.py +9 -20
  16. _mcp_mesh/pipeline/api_heartbeat/__init__.py +12 -7
  17. _mcp_mesh/pipeline/api_heartbeat/api_lifespan_integration.py +23 -49
  18. _mcp_mesh/pipeline/api_heartbeat/rust_api_heartbeat.py +429 -0
  19. _mcp_mesh/pipeline/api_startup/api_pipeline.py +7 -9
  20. _mcp_mesh/pipeline/api_startup/api_server_setup.py +91 -70
  21. _mcp_mesh/pipeline/api_startup/fastapi_discovery.py +22 -23
  22. _mcp_mesh/pipeline/api_startup/middleware_integration.py +32 -24
  23. _mcp_mesh/pipeline/api_startup/route_collection.py +2 -4
  24. _mcp_mesh/pipeline/mcp_heartbeat/__init__.py +5 -17
  25. _mcp_mesh/pipeline/mcp_heartbeat/rust_heartbeat.py +710 -0
  26. _mcp_mesh/pipeline/mcp_startup/__init__.py +2 -5
  27. _mcp_mesh/pipeline/mcp_startup/configuration.py +1 -1
  28. _mcp_mesh/pipeline/mcp_startup/fastapiserver_setup.py +31 -8
  29. _mcp_mesh/pipeline/mcp_startup/heartbeat_loop.py +6 -7
  30. _mcp_mesh/pipeline/mcp_startup/startup_orchestrator.py +23 -11
  31. _mcp_mesh/pipeline/mcp_startup/startup_pipeline.py +3 -8
  32. _mcp_mesh/pipeline/shared/mesh_pipeline.py +0 -2
  33. _mcp_mesh/reload.py +1 -3
  34. _mcp_mesh/shared/__init__.py +2 -8
  35. _mcp_mesh/shared/config_resolver.py +124 -80
  36. _mcp_mesh/shared/defaults.py +89 -14
  37. _mcp_mesh/shared/fastapi_middleware_manager.py +149 -91
  38. _mcp_mesh/shared/host_resolver.py +8 -46
  39. _mcp_mesh/shared/server_discovery.py +115 -86
  40. _mcp_mesh/shared/simple_shutdown.py +44 -86
  41. _mcp_mesh/tracing/execution_tracer.py +2 -6
  42. _mcp_mesh/tracing/redis_metadata_publisher.py +24 -79
  43. _mcp_mesh/tracing/trace_context_helper.py +3 -13
  44. _mcp_mesh/tracing/utils.py +29 -15
  45. _mcp_mesh/utils/fastmcp_schema_extractor.py +5 -4
  46. {mcp_mesh-0.7.21.dist-info → mcp_mesh-0.8.0.dist-info}/METADATA +7 -5
  47. mcp_mesh-0.8.0.dist-info/RECORD +85 -0
  48. mesh/__init__.py +12 -1
  49. mesh/decorators.py +248 -33
  50. mesh/helpers.py +52 -0
  51. mesh/types.py +40 -13
  52. _mcp_mesh/generated/.openapi-generator/FILES +0 -50
  53. _mcp_mesh/generated/.openapi-generator/VERSION +0 -1
  54. _mcp_mesh/generated/.openapi-generator-ignore +0 -15
  55. _mcp_mesh/generated/mcp_mesh_registry_client/__init__.py +0 -90
  56. _mcp_mesh/generated/mcp_mesh_registry_client/api/__init__.py +0 -6
  57. _mcp_mesh/generated/mcp_mesh_registry_client/api/agents_api.py +0 -1088
  58. _mcp_mesh/generated/mcp_mesh_registry_client/api/health_api.py +0 -764
  59. _mcp_mesh/generated/mcp_mesh_registry_client/api/tracing_api.py +0 -303
  60. _mcp_mesh/generated/mcp_mesh_registry_client/api_client.py +0 -798
  61. _mcp_mesh/generated/mcp_mesh_registry_client/api_response.py +0 -21
  62. _mcp_mesh/generated/mcp_mesh_registry_client/configuration.py +0 -577
  63. _mcp_mesh/generated/mcp_mesh_registry_client/exceptions.py +0 -217
  64. _mcp_mesh/generated/mcp_mesh_registry_client/models/__init__.py +0 -55
  65. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_info.py +0 -158
  66. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata.py +0 -126
  67. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner.py +0 -139
  68. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner_one_of.py +0 -92
  69. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration.py +0 -103
  70. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration_metadata.py +0 -136
  71. _mcp_mesh/generated/mcp_mesh_registry_client/models/agents_list_response.py +0 -100
  72. _mcp_mesh/generated/mcp_mesh_registry_client/models/capability_info.py +0 -107
  73. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_metadata.py +0 -112
  74. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_request.py +0 -103
  75. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_info.py +0 -105
  76. _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_info.py +0 -103
  77. _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_resolution_info.py +0 -106
  78. _mcp_mesh/generated/mcp_mesh_registry_client/models/error_response.py +0 -91
  79. _mcp_mesh/generated/mcp_mesh_registry_client/models/health_response.py +0 -103
  80. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request.py +0 -101
  81. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request_metadata.py +0 -111
  82. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_response.py +0 -117
  83. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider.py +0 -93
  84. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider_resolution_info.py +0 -106
  85. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter.py +0 -109
  86. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner.py +0 -139
  87. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner_one_of.py +0 -91
  88. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_info.py +0 -101
  89. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_resolution_info.py +0 -120
  90. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_register_metadata.py +0 -112
  91. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_registration.py +0 -129
  92. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response.py +0 -153
  93. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response_dependencies_resolved_value_inner.py +0 -101
  94. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_dependency_registration.py +0 -93
  95. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_register_metadata.py +0 -107
  96. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_registration.py +0 -117
  97. _mcp_mesh/generated/mcp_mesh_registry_client/models/registration_response.py +0 -119
  98. _mcp_mesh/generated/mcp_mesh_registry_client/models/resolved_llm_provider.py +0 -110
  99. _mcp_mesh/generated/mcp_mesh_registry_client/models/rich_dependency.py +0 -93
  100. _mcp_mesh/generated/mcp_mesh_registry_client/models/root_response.py +0 -92
  101. _mcp_mesh/generated/mcp_mesh_registry_client/models/standardized_dependency.py +0 -93
  102. _mcp_mesh/generated/mcp_mesh_registry_client/models/trace_event.py +0 -106
  103. _mcp_mesh/generated/mcp_mesh_registry_client/py.typed +0 -0
  104. _mcp_mesh/generated/mcp_mesh_registry_client/rest.py +0 -259
  105. _mcp_mesh/pipeline/api_heartbeat/api_dependency_resolution.py +0 -418
  106. _mcp_mesh/pipeline/api_heartbeat/api_fast_heartbeat_check.py +0 -117
  107. _mcp_mesh/pipeline/api_heartbeat/api_health_check.py +0 -140
  108. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_orchestrator.py +0 -243
  109. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_pipeline.py +0 -311
  110. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_send.py +0 -386
  111. _mcp_mesh/pipeline/api_heartbeat/api_registry_connection.py +0 -104
  112. _mcp_mesh/pipeline/mcp_heartbeat/dependency_resolution.py +0 -396
  113. _mcp_mesh/pipeline/mcp_heartbeat/fast_heartbeat_check.py +0 -116
  114. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_orchestrator.py +0 -311
  115. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_pipeline.py +0 -282
  116. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_send.py +0 -98
  117. _mcp_mesh/pipeline/mcp_heartbeat/lifespan_integration.py +0 -84
  118. _mcp_mesh/pipeline/mcp_heartbeat/llm_tools_resolution.py +0 -264
  119. _mcp_mesh/pipeline/mcp_heartbeat/registry_connection.py +0 -79
  120. _mcp_mesh/pipeline/shared/registry_connection.py +0 -80
  121. _mcp_mesh/shared/registry_client_wrapper.py +0 -515
  122. mcp_mesh-0.7.21.dist-info/RECORD +0 -152
  123. {mcp_mesh-0.7.21.dist-info → mcp_mesh-0.8.0.dist-info}/WHEEL +0 -0
  124. {mcp_mesh-0.7.21.dist-info → mcp_mesh-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,106 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from datetime import datetime
22
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
- from typing import Any, ClassVar, Dict, List, Optional
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class TraceEvent(BaseModel):
28
- """
29
- Individual trace event streamed via SSE
30
- """ # noqa: E501
31
- event_type: StrictStr = Field(description="Type of trace event")
32
- trace_id: StrictStr = Field(description="Trace identifier this event belongs to")
33
- timestamp: datetime = Field(description="When this event occurred")
34
- agent_id: StrictStr = Field(description="Agent that generated this event")
35
- details: Optional[Dict[str, Any]] = Field(default=None, description="Event-specific details")
36
- correlation_id: Optional[StrictStr] = Field(default=None, description="Optional correlation ID for request tracking")
37
- parent_span_id: Optional[StrictStr] = Field(default=None, description="Parent span for distributed tracing hierarchy")
38
- __properties: ClassVar[List[str]] = ["event_type", "trace_id", "timestamp", "agent_id", "details", "correlation_id", "parent_span_id"]
39
-
40
- @field_validator('event_type')
41
- def event_type_validate_enum(cls, value):
42
- """Validates the enum"""
43
- if value not in set(['task_started', 'task_progress', 'task_completed', 'task_failed', 'agent_called', 'dependency_resolved']):
44
- raise ValueError("must be one of enum values ('task_started', 'task_progress', 'task_completed', 'task_failed', 'agent_called', 'dependency_resolved')")
45
- return value
46
-
47
- model_config = ConfigDict(
48
- populate_by_name=True,
49
- validate_assignment=True,
50
- protected_namespaces=(),
51
- )
52
-
53
-
54
- def to_str(self) -> str:
55
- """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.model_dump(by_alias=True))
57
-
58
- def to_json(self) -> str:
59
- """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
-
63
- @classmethod
64
- def from_json(cls, json_str: str) -> Optional[Self]:
65
- """Create an instance of TraceEvent from a JSON string"""
66
- return cls.from_dict(json.loads(json_str))
67
-
68
- def to_dict(self) -> Dict[str, Any]:
69
- """Return the dictionary representation of the model using alias.
70
-
71
- This has the following differences from calling pydantic's
72
- `self.model_dump(by_alias=True)`:
73
-
74
- * `None` is only added to the output dict for nullable fields that
75
- were set at model initialization. Other fields with value `None`
76
- are ignored.
77
- """
78
- excluded_fields: Set[str] = set([
79
- ])
80
-
81
- _dict = self.model_dump(
82
- by_alias=True,
83
- exclude=excluded_fields,
84
- exclude_none=True,
85
- )
86
- return _dict
87
-
88
- @classmethod
89
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
- """Create an instance of TraceEvent from a dict"""
91
- if obj is None:
92
- return None
93
-
94
- if not isinstance(obj, dict):
95
- return cls.model_validate(obj)
96
-
97
- _obj = cls.model_validate({
98
- "event_type": obj.get("event_type"),
99
- "trace_id": obj.get("trace_id"),
100
- "timestamp": obj.get("timestamp"),
101
- "agent_id": obj.get("agent_id"),
102
- "details": obj.get("details"),
103
- "correlation_id": obj.get("correlation_id"),
104
- "parent_span_id": obj.get("parent_span_id")
105
- })
106
- return _obj
File without changes
@@ -1,259 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- import io
17
- import json
18
- import re
19
- import ssl
20
-
21
- import urllib3
22
-
23
- from _mcp_mesh.generated.mcp_mesh_registry_client.exceptions import ApiException, ApiValueError
24
-
25
- SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
26
- RESTResponseType = urllib3.HTTPResponse
27
-
28
-
29
- def is_socks_proxy_url(url):
30
- if url is None:
31
- return False
32
- split_section = url.split("://")
33
- if len(split_section) < 2:
34
- return False
35
- else:
36
- return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
37
-
38
-
39
- class RESTResponse(io.IOBase):
40
-
41
- def __init__(self, resp) -> None:
42
- self.response = resp
43
- self.status = resp.status
44
- self.reason = resp.reason
45
- self.data = None
46
-
47
- def read(self):
48
- if self.data is None:
49
- self.data = self.response.data
50
- return self.data
51
-
52
- def getheaders(self):
53
- """Returns a dictionary of the response headers."""
54
- return self.response.headers
55
-
56
- def getheader(self, name, default=None):
57
- """Returns a given response header."""
58
- return self.response.headers.get(name, default)
59
-
60
-
61
- class RESTClientObject:
62
-
63
- def __init__(self, configuration) -> None:
64
- # urllib3.PoolManager will pass all kw parameters to connectionpool
65
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
66
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
67
- # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
68
-
69
- # cert_reqs
70
- if configuration.verify_ssl:
71
- cert_reqs = ssl.CERT_REQUIRED
72
- else:
73
- cert_reqs = ssl.CERT_NONE
74
-
75
- pool_args = {
76
- "cert_reqs": cert_reqs,
77
- "ca_certs": configuration.ssl_ca_cert,
78
- "cert_file": configuration.cert_file,
79
- "key_file": configuration.key_file,
80
- "ca_cert_data": configuration.ca_cert_data,
81
- }
82
- if configuration.assert_hostname is not None:
83
- pool_args['assert_hostname'] = (
84
- configuration.assert_hostname
85
- )
86
-
87
- if configuration.retries is not None:
88
- pool_args['retries'] = configuration.retries
89
-
90
- if configuration.tls_server_name:
91
- pool_args['server_hostname'] = configuration.tls_server_name
92
-
93
-
94
- if configuration.socket_options is not None:
95
- pool_args['socket_options'] = configuration.socket_options
96
-
97
- if configuration.connection_pool_maxsize is not None:
98
- pool_args['maxsize'] = configuration.connection_pool_maxsize
99
-
100
- # https pool manager
101
- self.pool_manager: urllib3.PoolManager
102
-
103
- if configuration.proxy:
104
- if is_socks_proxy_url(configuration.proxy):
105
- from urllib3.contrib.socks import SOCKSProxyManager
106
- pool_args["proxy_url"] = configuration.proxy
107
- pool_args["headers"] = configuration.proxy_headers
108
- self.pool_manager = SOCKSProxyManager(**pool_args)
109
- else:
110
- pool_args["proxy_url"] = configuration.proxy
111
- pool_args["proxy_headers"] = configuration.proxy_headers
112
- self.pool_manager = urllib3.ProxyManager(**pool_args)
113
- else:
114
- self.pool_manager = urllib3.PoolManager(**pool_args)
115
-
116
- def request(
117
- self,
118
- method,
119
- url,
120
- headers=None,
121
- body=None,
122
- post_params=None,
123
- _request_timeout=None
124
- ):
125
- """Perform requests.
126
-
127
- :param method: http request method
128
- :param url: http request url
129
- :param headers: http request headers
130
- :param body: request json body, for `application/json`
131
- :param post_params: request post parameters,
132
- `application/x-www-form-urlencoded`
133
- and `multipart/form-data`
134
- :param _request_timeout: timeout setting for this request. If one
135
- number provided, it will be total request
136
- timeout. It can also be a pair (tuple) of
137
- (connection, read) timeouts.
138
- """
139
- method = method.upper()
140
- assert method in [
141
- 'GET',
142
- 'HEAD',
143
- 'DELETE',
144
- 'POST',
145
- 'PUT',
146
- 'PATCH',
147
- 'OPTIONS'
148
- ]
149
-
150
- if post_params and body:
151
- raise ApiValueError(
152
- "body parameter cannot be used with post_params parameter."
153
- )
154
-
155
- post_params = post_params or {}
156
- headers = headers or {}
157
-
158
- timeout = None
159
- if _request_timeout:
160
- if isinstance(_request_timeout, (int, float)):
161
- timeout = urllib3.Timeout(total=_request_timeout)
162
- elif (
163
- isinstance(_request_timeout, tuple)
164
- and len(_request_timeout) == 2
165
- ):
166
- timeout = urllib3.Timeout(
167
- connect=_request_timeout[0],
168
- read=_request_timeout[1]
169
- )
170
-
171
- try:
172
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
173
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
174
-
175
- # no content type provided or payload is json
176
- content_type = headers.get('Content-Type')
177
- if (
178
- not content_type
179
- or re.search('json', content_type, re.IGNORECASE)
180
- ):
181
- request_body = None
182
- if body is not None:
183
- request_body = json.dumps(body)
184
- r = self.pool_manager.request(
185
- method,
186
- url,
187
- body=request_body,
188
- timeout=timeout,
189
- headers=headers,
190
- preload_content=False
191
- )
192
- elif content_type == 'application/x-www-form-urlencoded':
193
- r = self.pool_manager.request(
194
- method,
195
- url,
196
- fields=post_params,
197
- encode_multipart=False,
198
- timeout=timeout,
199
- headers=headers,
200
- preload_content=False
201
- )
202
- elif content_type == 'multipart/form-data':
203
- # must del headers['Content-Type'], or the correct
204
- # Content-Type which generated by urllib3 will be
205
- # overwritten.
206
- del headers['Content-Type']
207
- # Ensures that dict objects are serialized
208
- post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
209
- r = self.pool_manager.request(
210
- method,
211
- url,
212
- fields=post_params,
213
- encode_multipart=True,
214
- timeout=timeout,
215
- headers=headers,
216
- preload_content=False
217
- )
218
- # Pass a `string` parameter directly in the body to support
219
- # other content types than JSON when `body` argument is
220
- # provided in serialized form.
221
- elif isinstance(body, str) or isinstance(body, bytes):
222
- r = self.pool_manager.request(
223
- method,
224
- url,
225
- body=body,
226
- timeout=timeout,
227
- headers=headers,
228
- preload_content=False
229
- )
230
- elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
231
- request_body = "true" if body else "false"
232
- r = self.pool_manager.request(
233
- method,
234
- url,
235
- body=request_body,
236
- preload_content=False,
237
- timeout=timeout,
238
- headers=headers)
239
- else:
240
- # Cannot generate the request from given parameters
241
- msg = """Cannot prepare a request message for provided
242
- arguments. Please check that your arguments match
243
- declared content type."""
244
- raise ApiException(status=0, reason=msg)
245
- # For `GET`, `HEAD`
246
- else:
247
- r = self.pool_manager.request(
248
- method,
249
- url,
250
- fields={},
251
- timeout=timeout,
252
- headers=headers,
253
- preload_content=False
254
- )
255
- except urllib3.exceptions.SSLError as e:
256
- msg = "\n".join([type(e).__name__, str(e)])
257
- raise ApiException(status=0, reason=msg)
258
-
259
- return RESTResponse(r)