catocli 1.0.12__py3-none-any.whl → 1.0.13__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.

Potentially problematic release.


This version of catocli might be problematic. Click here for more details.

Files changed (105) hide show
  1. build/lib/catocli/Utils/clidriver.py +117 -0
  2. build/lib/catocli/__init__.py +2 -0
  3. build/lib/catocli/__main__.py +12 -0
  4. build/lib/catocli/parsers/custom/__init__.py +47 -0
  5. build/lib/catocli/parsers/custom/customLib.py +70 -0
  6. build/lib/catocli/parsers/mutation_admin/__init__.py +51 -0
  7. build/lib/catocli/parsers/mutation_container/__init__.py +23 -0
  8. build/lib/catocli/parsers/mutation_policy/__init__.py +357 -0
  9. build/lib/catocli/parsers/mutation_site/__init__.py +219 -0
  10. build/lib/catocli/parsers/mutation_sites/__init__.py +219 -0
  11. build/lib/catocli/parsers/parserApiClient.py +309 -0
  12. build/lib/catocli/parsers/query_accountBySubdomain/__init__.py +17 -0
  13. build/lib/catocli/parsers/query_accountMetrics/__init__.py +17 -0
  14. build/lib/catocli/parsers/query_accountRoles/__init__.py +17 -0
  15. build/lib/catocli/parsers/query_accountSnapshot/__init__.py +17 -0
  16. build/lib/catocli/parsers/query_admin/__init__.py +17 -0
  17. build/lib/catocli/parsers/query_admins/__init__.py +17 -0
  18. build/lib/catocli/parsers/query_appStats/__init__.py +17 -0
  19. build/lib/catocli/parsers/query_appStatsTimeSeries/__init__.py +17 -0
  20. build/lib/catocli/parsers/query_auditFeed/__init__.py +17 -0
  21. build/lib/catocli/parsers/query_container/__init__.py +17 -0
  22. build/lib/catocli/parsers/query_entityLookup/__init__.py +17 -0
  23. build/lib/catocli/parsers/query_events/__init__.py +17 -0
  24. build/lib/catocli/parsers/query_eventsFeed/__init__.py +17 -0
  25. build/lib/catocli/parsers/query_eventsTimeSeries/__init__.py +17 -0
  26. build/lib/catocli/parsers/query_hardwareManagement/__init__.py +17 -0
  27. build/lib/catocli/parsers/query_licensing/__init__.py +17 -0
  28. build/lib/catocli/parsers/query_policy/__init__.py +17 -0
  29. build/lib/catocli/parsers/query_siteLocation/__init__.py +17 -0
  30. build/lib/catocli/parsers/query_subDomains/__init__.py +17 -0
  31. build/lib/catocli/parsers/query_xdr/__init__.py +37 -0
  32. build/lib/catocli/parsers/raw/__init__.py +9 -0
  33. build/lib/graphql_client/__init__.py +11 -0
  34. build/lib/graphql_client/api/__init__.py +3 -0
  35. build/lib/graphql_client/api/call_api.py +73 -0
  36. build/lib/graphql_client/api_client.py +192 -0
  37. build/lib/graphql_client/api_client_types.py +404 -0
  38. build/lib/graphql_client/configuration.py +230 -0
  39. build/lib/graphql_client/models/__init__.py +13 -0
  40. build/lib/graphql_client/models/no_schema.py +71 -0
  41. build/lib/schema/catolib.py +1016 -0
  42. build/lib/schema/importSchema.py +60 -0
  43. build/lib/vendor/certifi/__init__.py +4 -0
  44. build/lib/vendor/certifi/__main__.py +12 -0
  45. build/lib/vendor/certifi/core.py +114 -0
  46. build/lib/vendor/certifi/py.typed +0 -0
  47. build/lib/vendor/six.py +998 -0
  48. build/lib/vendor/urllib3/__init__.py +211 -0
  49. build/lib/vendor/urllib3/_base_connection.py +172 -0
  50. build/lib/vendor/urllib3/_collections.py +483 -0
  51. build/lib/vendor/urllib3/_request_methods.py +278 -0
  52. build/lib/vendor/urllib3/_version.py +16 -0
  53. build/lib/vendor/urllib3/connection.py +1033 -0
  54. build/lib/vendor/urllib3/connectionpool.py +1182 -0
  55. build/lib/vendor/urllib3/contrib/__init__.py +0 -0
  56. build/lib/vendor/urllib3/contrib/emscripten/__init__.py +18 -0
  57. build/lib/vendor/urllib3/contrib/emscripten/connection.py +254 -0
  58. build/lib/vendor/urllib3/contrib/emscripten/fetch.py +418 -0
  59. build/lib/vendor/urllib3/contrib/emscripten/request.py +22 -0
  60. build/lib/vendor/urllib3/contrib/emscripten/response.py +285 -0
  61. build/lib/vendor/urllib3/contrib/pyopenssl.py +552 -0
  62. build/lib/vendor/urllib3/contrib/socks.py +228 -0
  63. build/lib/vendor/urllib3/exceptions.py +321 -0
  64. build/lib/vendor/urllib3/fields.py +341 -0
  65. build/lib/vendor/urllib3/filepost.py +89 -0
  66. build/lib/vendor/urllib3/http2/__init__.py +53 -0
  67. build/lib/vendor/urllib3/http2/connection.py +356 -0
  68. build/lib/vendor/urllib3/http2/probe.py +87 -0
  69. build/lib/vendor/urllib3/poolmanager.py +637 -0
  70. build/lib/vendor/urllib3/py.typed +2 -0
  71. build/lib/vendor/urllib3/response.py +1265 -0
  72. build/lib/vendor/urllib3/util/__init__.py +42 -0
  73. build/lib/vendor/urllib3/util/connection.py +137 -0
  74. build/lib/vendor/urllib3/util/proxy.py +43 -0
  75. build/lib/vendor/urllib3/util/request.py +256 -0
  76. build/lib/vendor/urllib3/util/response.py +101 -0
  77. build/lib/vendor/urllib3/util/retry.py +533 -0
  78. build/lib/vendor/urllib3/util/ssl_.py +513 -0
  79. build/lib/vendor/urllib3/util/ssl_match_hostname.py +159 -0
  80. build/lib/vendor/urllib3/util/ssltransport.py +276 -0
  81. build/lib/vendor/urllib3/util/timeout.py +275 -0
  82. build/lib/vendor/urllib3/util/url.py +471 -0
  83. build/lib/vendor/urllib3/util/util.py +42 -0
  84. build/lib/vendor/urllib3/util/wait.py +124 -0
  85. catocli/__init__.py +1 -1
  86. catocli/parsers/custom/__init__.py +1 -1
  87. catocli/parsers/custom/customLib.py +1 -2
  88. catocli/parsers/mutation_site_updateSiteGeneralDetails/README.md +1 -1
  89. catocli/parsers/mutation_sites_updateSiteGeneralDetails/README.md +1 -1
  90. catocli/parsers/query_eventsFeed/README.md +1 -1
  91. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/METADATA +1 -1
  92. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/RECORD +104 -21
  93. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/top_level.txt +2 -0
  94. models/mutation.site.updateSiteGeneralDetails.json +57 -0
  95. models/mutation.sites.updateSiteGeneralDetails.json +57 -0
  96. models/query.accountMetrics.json +80 -0
  97. models/query.accountSnapshot.json +40 -0
  98. models/query.auditFeed.json +60 -0
  99. models/query.events.json +240 -0
  100. models/query.eventsFeed.json +60 -0
  101. models/query.eventsTimeSeries.json +180 -0
  102. vendor/.DS_Store +0 -0
  103. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/LICENSE +0 -0
  104. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/WHEEL +0 -0
  105. {catocli-1.0.12.dist-info → catocli-1.0.13.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,22 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+
5
+ from ..._base_connection import _TYPE_BODY
6
+
7
+
8
+ @dataclass
9
+ class EmscriptenRequest:
10
+ method: str
11
+ url: str
12
+ params: dict[str, str] | None = None
13
+ body: _TYPE_BODY | None = None
14
+ headers: dict[str, str] = field(default_factory=dict)
15
+ timeout: float = 0
16
+ decode_content: bool = True
17
+
18
+ def set_header(self, name: str, value: str) -> None:
19
+ self.headers[name.capitalize()] = value
20
+
21
+ def set_body(self, body: _TYPE_BODY | None) -> None:
22
+ self.body = body
@@ -0,0 +1,285 @@
1
+ from __future__ import annotations
2
+
3
+ import json as _json
4
+ import logging
5
+ import typing
6
+ from contextlib import contextmanager
7
+ from dataclasses import dataclass
8
+ from http.client import HTTPException as HTTPException
9
+ from io import BytesIO, IOBase
10
+
11
+ from ...exceptions import InvalidHeader, TimeoutError
12
+ from ...response import BaseHTTPResponse
13
+ from ...util.retry import Retry
14
+ from .request import EmscriptenRequest
15
+
16
+ if typing.TYPE_CHECKING:
17
+ from ..._base_connection import BaseHTTPConnection, BaseHTTPSConnection
18
+
19
+ log = logging.getLogger(__name__)
20
+
21
+
22
+ @dataclass
23
+ class EmscriptenResponse:
24
+ status_code: int
25
+ headers: dict[str, str]
26
+ body: IOBase | bytes
27
+ request: EmscriptenRequest
28
+
29
+
30
+ class EmscriptenHttpResponseWrapper(BaseHTTPResponse):
31
+ def __init__(
32
+ self,
33
+ internal_response: EmscriptenResponse,
34
+ url: str | None = None,
35
+ connection: BaseHTTPConnection | BaseHTTPSConnection | None = None,
36
+ ):
37
+ self._pool = None # set by pool class
38
+ self._body = None
39
+ self._response = internal_response
40
+ self._url = url
41
+ self._connection = connection
42
+ self._closed = False
43
+ super().__init__(
44
+ headers=internal_response.headers,
45
+ status=internal_response.status_code,
46
+ request_url=url,
47
+ version=0,
48
+ version_string="HTTP/?",
49
+ reason="",
50
+ decode_content=True,
51
+ )
52
+ self.length_remaining = self._init_length(self._response.request.method)
53
+ self.length_is_certain = False
54
+
55
+ @property
56
+ def url(self) -> str | None:
57
+ return self._url
58
+
59
+ @url.setter
60
+ def url(self, url: str | None) -> None:
61
+ self._url = url
62
+
63
+ @property
64
+ def connection(self) -> BaseHTTPConnection | BaseHTTPSConnection | None:
65
+ return self._connection
66
+
67
+ @property
68
+ def retries(self) -> Retry | None:
69
+ return self._retries
70
+
71
+ @retries.setter
72
+ def retries(self, retries: Retry | None) -> None:
73
+ # Override the request_url if retries has a redirect location.
74
+ self._retries = retries
75
+
76
+ def stream(
77
+ self, amt: int | None = 2**16, decode_content: bool | None = None
78
+ ) -> typing.Generator[bytes, None, None]:
79
+ """
80
+ A generator wrapper for the read() method. A call will block until
81
+ ``amt`` bytes have been read from the connection or until the
82
+ connection is closed.
83
+
84
+ :param amt:
85
+ How much of the content to read. The generator will return up to
86
+ much data per iteration, but may return less. This is particularly
87
+ likely when using compressed data. However, the empty string will
88
+ never be returned.
89
+
90
+ :param decode_content:
91
+ If True, will attempt to decode the body based on the
92
+ 'content-encoding' header.
93
+ """
94
+ while True:
95
+ data = self.read(amt=amt, decode_content=decode_content)
96
+
97
+ if data:
98
+ yield data
99
+ else:
100
+ break
101
+
102
+ def _init_length(self, request_method: str | None) -> int | None:
103
+ length: int | None
104
+ content_length: str | None = self.headers.get("content-length")
105
+
106
+ if content_length is not None:
107
+ try:
108
+ # RFC 7230 section 3.3.2 specifies multiple content lengths can
109
+ # be sent in a single Content-Length header
110
+ # (e.g. Content-Length: 42, 42). This line ensures the values
111
+ # are all valid ints and that as long as the `set` length is 1,
112
+ # all values are the same. Otherwise, the header is invalid.
113
+ lengths = {int(val) for val in content_length.split(",")}
114
+ if len(lengths) > 1:
115
+ raise InvalidHeader(
116
+ "Content-Length contained multiple "
117
+ "unmatching values (%s)" % content_length
118
+ )
119
+ length = lengths.pop()
120
+ except ValueError:
121
+ length = None
122
+ else:
123
+ if length < 0:
124
+ length = None
125
+
126
+ else: # if content_length is None
127
+ length = None
128
+
129
+ # Check for responses that shouldn't include a body
130
+ if (
131
+ self.status in (204, 304)
132
+ or 100 <= self.status < 200
133
+ or request_method == "HEAD"
134
+ ):
135
+ length = 0
136
+
137
+ return length
138
+
139
+ def read(
140
+ self,
141
+ amt: int | None = None,
142
+ decode_content: bool | None = None, # ignored because browser decodes always
143
+ cache_content: bool = False,
144
+ ) -> bytes:
145
+ if (
146
+ self._closed
147
+ or self._response is None
148
+ or (isinstance(self._response.body, IOBase) and self._response.body.closed)
149
+ ):
150
+ return b""
151
+
152
+ with self._error_catcher():
153
+ # body has been preloaded as a string by XmlHttpRequest
154
+ if not isinstance(self._response.body, IOBase):
155
+ self.length_remaining = len(self._response.body)
156
+ self.length_is_certain = True
157
+ # wrap body in IOStream
158
+ self._response.body = BytesIO(self._response.body)
159
+ if amt is not None and amt >= 0:
160
+ # don't cache partial content
161
+ cache_content = False
162
+ data = self._response.body.read(amt)
163
+ if self.length_remaining is not None:
164
+ self.length_remaining = max(self.length_remaining - len(data), 0)
165
+ if (self.length_is_certain and self.length_remaining == 0) or len(
166
+ data
167
+ ) < amt:
168
+ # definitely finished reading, close response stream
169
+ self._response.body.close()
170
+ return typing.cast(bytes, data)
171
+ else: # read all we can (and cache it)
172
+ data = self._response.body.read()
173
+ if cache_content:
174
+ self._body = data
175
+ if self.length_remaining is not None:
176
+ self.length_remaining = max(self.length_remaining - len(data), 0)
177
+ if len(data) == 0 or (
178
+ self.length_is_certain and self.length_remaining == 0
179
+ ):
180
+ # definitely finished reading, close response stream
181
+ self._response.body.close()
182
+ return typing.cast(bytes, data)
183
+
184
+ def read_chunked(
185
+ self,
186
+ amt: int | None = None,
187
+ decode_content: bool | None = None,
188
+ ) -> typing.Generator[bytes, None, None]:
189
+ # chunked is handled by browser
190
+ while True:
191
+ bytes = self.read(amt, decode_content)
192
+ if not bytes:
193
+ break
194
+ yield bytes
195
+
196
+ def release_conn(self) -> None:
197
+ if not self._pool or not self._connection:
198
+ return None
199
+
200
+ self._pool._put_conn(self._connection)
201
+ self._connection = None
202
+
203
+ def drain_conn(self) -> None:
204
+ self.close()
205
+
206
+ @property
207
+ def data(self) -> bytes:
208
+ if self._body:
209
+ return self._body
210
+ else:
211
+ return self.read(cache_content=True)
212
+
213
+ def json(self) -> typing.Any:
214
+ """
215
+ Deserializes the body of the HTTP response as a Python object.
216
+
217
+ The body of the HTTP response must be encoded using UTF-8, as per
218
+ `RFC 8529 Section 8.1 <https://www.rfc-editor.org/rfc/rfc8259#section-8.1>`_.
219
+
220
+ To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to
221
+ your custom decoder instead.
222
+
223
+ If the body of the HTTP response is not decodable to UTF-8, a
224
+ `UnicodeDecodeError` will be raised. If the body of the HTTP response is not a
225
+ valid JSON document, a `json.JSONDecodeError` will be raised.
226
+
227
+ Read more :ref:`here <json_content>`.
228
+
229
+ :returns: The body of the HTTP response as a Python object.
230
+ """
231
+ data = self.data.decode("utf-8")
232
+ return _json.loads(data)
233
+
234
+ def close(self) -> None:
235
+ if not self._closed:
236
+ if isinstance(self._response.body, IOBase):
237
+ self._response.body.close()
238
+ if self._connection:
239
+ self._connection.close()
240
+ self._connection = None
241
+ self._closed = True
242
+
243
+ @contextmanager
244
+ def _error_catcher(self) -> typing.Generator[None, None, None]:
245
+ """
246
+ Catch Emscripten specific exceptions thrown by fetch.py,
247
+ instead re-raising urllib3 variants, so that low-level exceptions
248
+ are not leaked in the high-level api.
249
+
250
+ On exit, release the connection back to the pool.
251
+ """
252
+ from .fetch import _RequestError, _TimeoutError # avoid circular import
253
+
254
+ clean_exit = False
255
+
256
+ try:
257
+ yield
258
+ # If no exception is thrown, we should avoid cleaning up
259
+ # unnecessarily.
260
+ clean_exit = True
261
+ except _TimeoutError as e:
262
+ raise TimeoutError(str(e))
263
+ except _RequestError as e:
264
+ raise HTTPException(str(e))
265
+ finally:
266
+ # If we didn't terminate cleanly, we need to throw away our
267
+ # connection.
268
+ if not clean_exit:
269
+ # The response may not be closed but we're not going to use it
270
+ # anymore so close it now
271
+ if (
272
+ isinstance(self._response.body, IOBase)
273
+ and not self._response.body.closed
274
+ ):
275
+ self._response.body.close()
276
+ # release the connection back to the pool
277
+ self.release_conn()
278
+ else:
279
+ # If we have read everything from the response stream,
280
+ # return the connection back to the pool.
281
+ if (
282
+ isinstance(self._response.body, IOBase)
283
+ and self._response.body.closed
284
+ ):
285
+ self.release_conn()