OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
elastic_transport
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
01/09/2025 02:18:04 AM
rwxr-xr-x
📄
__init__.py
3.91 KB
05/14/2024 03:17:35 PM
rw-r--r--
📁
__pycache__
-
05/14/2024 03:17:35 PM
rwxr-xr-x
📄
_async_transport.py
19.74 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_compat.py
3.47 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_exceptions.py
3.78 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_models.py
12.56 KB
05/14/2024 03:17:35 PM
rw-r--r--
📁
_node
-
05/14/2024 03:17:35 PM
rwxr-xr-x
📄
_node_pool.py
14.67 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_otel.py
2.98 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_response.py
6.25 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_serializer.py
8.41 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_transport.py
22.95 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_utils.py
3.28 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
_version.py
811 bytes
05/14/2024 03:17:35 PM
rw-r--r--
📄
client_utils.py
8.02 KB
05/14/2024 03:17:35 PM
rw-r--r--
📄
py.typed
0 bytes
05/14/2024 03:17:35 PM
rw-r--r--
Editing: _exceptions.py
Close
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from typing import Any, Tuple from ._models import ApiResponseMeta class TransportWarning(Warning): """Generic warning for the 'elastic-transport' package.""" class SecurityWarning(TransportWarning): """Warning for potentially insecure configurations.""" class TransportError(Exception): """Generic exception for the 'elastic-transport' package. For the 'errors' attribute, errors are ordered from most recently raised (index=0) to least recently raised (index=N) If an HTTP status code is available with the error it will be stored under 'status'. If HTTP headers are available they are stored under 'headers'. """ def __init__(self, message: Any, errors: Tuple[Exception, ...] = ()): super().__init__(message) self.errors = tuple(errors) self.message = message def __repr__(self) -> str: parts = [repr(self.message)] if self.errors: parts.append(f"errors={self.errors!r}") return "{}({})".format(self.__class__.__name__, ", ".join(parts)) def __str__(self) -> str: return str(self.message) class SniffingError(TransportError): """Error that occurs during the sniffing of nodes""" class SerializationError(TransportError): """Error that occurred during the serialization or deserialization of an HTTP message body """ class ConnectionError(TransportError): """Error raised by the HTTP connection""" def __str__(self) -> str: if self.errors: return f"Connection error caused by: {self.errors[0].__class__.__name__}({self.errors[0]})" return "Connection error" class TlsError(ConnectionError): """Error raised by during the TLS handshake""" def __str__(self) -> str: if self.errors: return f"TLS error caused by: {self.errors[0].__class__.__name__}({self.errors[0]})" return "TLS error" class ConnectionTimeout(TransportError): """Connection timed out during an operation""" def __str__(self) -> str: if self.errors: return f"Connection timeout caused by: {self.errors[0].__class__.__name__}({self.errors[0]})" return "Connection timed out" class ApiError(Exception): """Base-class for clients that raise errors due to a response such as '404 Not Found'""" def __init__( self, message: str, meta: ApiResponseMeta, body: Any, errors: Tuple[Exception, ...] = (), ): super().__init__(message) self.message = message self.errors = errors self.meta = meta self.body = body def __repr__(self) -> str: parts = [repr(self.message)] if self.meta: parts.append(f"meta={self.meta!r}") if self.errors: parts.append(f"errors={self.errors!r}") if self.body is not None: parts.append(f"body={self.body!r}") return "{}({})".format(self.__class__.__name__, ", ".join(parts)) def __str__(self) -> str: return f"[{self.meta.status}] {self.message}"