appmesh 1.6.10__py3-none-any.whl → 1.6.11__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.
- appmesh/app_output.py +2 -2
- appmesh/client_http.py +19 -11
- appmesh/client_tcp.py +7 -2
- appmesh/server_http.py +4 -1
- appmesh/server_tcp.py +4 -1
- appmesh/tcp_messages.py +3 -0
- appmesh/tcp_transport.py +1 -0
- {appmesh-1.6.10.dist-info → appmesh-1.6.11.dist-info}/METADATA +1 -1
- appmesh-1.6.11.dist-info/RECORD +16 -0
- appmesh-1.6.10.dist-info/RECORD +0 -16
- {appmesh-1.6.10.dist-info → appmesh-1.6.11.dist-info}/WHEEL +0 -0
- {appmesh-1.6.10.dist-info → appmesh-1.6.11.dist-info}/top_level.txt +0 -0
appmesh/app_output.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# app_output.py
|
2
|
+
# pylint: disable=line-too-long
|
2
3
|
"""Application output information"""
|
3
4
|
|
5
|
+
# Standard library imports
|
4
6
|
from http import HTTPStatus
|
5
7
|
from typing import Optional
|
6
8
|
|
7
|
-
# pylint: disable=line-too-long
|
8
|
-
|
9
9
|
|
10
10
|
class AppOutput(object):
|
11
11
|
"""
|
appmesh/client_http.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# client_http.py
|
2
2
|
# pylint: disable=broad-exception-raised,line-too-long,broad-exception-caught,too-many-lines,import-outside-toplevel
|
3
|
+
|
4
|
+
# Standard library imports
|
3
5
|
import abc
|
4
6
|
import base64
|
7
|
+
import http.cookiejar as cookiejar
|
5
8
|
import json
|
6
9
|
import locale
|
7
10
|
import logging
|
@@ -9,19 +12,21 @@ import os
|
|
9
12
|
import sys
|
10
13
|
import threading
|
11
14
|
import time
|
12
|
-
import requests
|
13
|
-
import http.cookiejar as cookiejar
|
14
15
|
from datetime import datetime
|
15
16
|
from enum import Enum, unique
|
16
17
|
from http import HTTPStatus
|
17
|
-
import threading
|
18
18
|
from typing import Optional, Tuple, Union
|
19
19
|
from urllib import parse
|
20
|
+
|
21
|
+
# Third-party imports
|
20
22
|
import aniso8601
|
21
23
|
import jwt
|
24
|
+
import requests
|
25
|
+
|
26
|
+
# Local imports
|
22
27
|
from .app import App
|
23
|
-
from .app_run import AppRun
|
24
28
|
from .app_output import AppOutput
|
29
|
+
from .app_run import AppRun
|
25
30
|
|
26
31
|
|
27
32
|
class AppMeshClient(metaclass=abc.ABCMeta):
|
@@ -220,7 +225,8 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
220
225
|
rest_timeout (tuple, optional): HTTP connection timeouts for API requests, as `(connect_timeout, read_timeout)`.
|
221
226
|
The default is `(60, 300)`, where `60` seconds is the maximum time to establish a connection and `300` seconds for the maximum read duration.
|
222
227
|
|
223
|
-
rest_cookie_file (str, optional): Path to a file for storing session cookies.
|
228
|
+
rest_cookie_file (str, optional): Path to a file for storing session cookies.
|
229
|
+
If provided, cookies will be saved to and loaded from this file to maintain session state across client instances instead of keep jwt_token.
|
224
230
|
|
225
231
|
jwt_token (str, optional): JWT token for API authentication, used in headers to authorize requests where required.
|
226
232
|
auto_refresh_token (bool, optional): Enable automatic token refresh before expiration.
|
@@ -235,16 +241,16 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
235
241
|
self.rest_timeout = rest_timeout
|
236
242
|
self._forward_to = None
|
237
243
|
|
238
|
-
# Session and cookie management
|
239
|
-
self._lock = threading.Lock()
|
240
|
-
self.session = requests.Session()
|
241
|
-
self.cookie_file = self._load_cookies(rest_cookie_file)
|
242
|
-
|
243
244
|
# Token auto-refresh
|
244
245
|
self._token_refresh_timer = None
|
245
246
|
self._auto_refresh_token = auto_refresh_token
|
246
247
|
self.jwt_token = jwt_token # Set property last after all dependencies are initialized to setup refresh timer
|
247
248
|
|
249
|
+
# Session and cookie management
|
250
|
+
self._lock = threading.Lock()
|
251
|
+
self.session = requests.Session()
|
252
|
+
self.cookie_file = self._load_cookies(rest_cookie_file)
|
253
|
+
|
248
254
|
@staticmethod
|
249
255
|
def _ensure_logging_configured():
|
250
256
|
"""Ensure logging is configured. If no handlers are configured, add a default console handler."""
|
@@ -262,6 +268,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
262
268
|
self.session.cookies = cookiejar.MozillaCookieJar(cookie_file)
|
263
269
|
if os.path.exists(cookie_file):
|
264
270
|
self.session.cookies.load(ignore_discard=True, ignore_expires=True)
|
271
|
+
self.jwt_token = self._get_cookie_value(self.session.cookies, self.COOKIE_TOKEN)
|
265
272
|
else:
|
266
273
|
os.makedirs(os.path.dirname(cookie_file), exist_ok=True)
|
267
274
|
self.session.cookies.save(ignore_discard=True, ignore_expires=True)
|
@@ -453,7 +460,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
453
460
|
|
454
461
|
# handle session
|
455
462
|
with self._lock:
|
456
|
-
if self.cookie_file:
|
463
|
+
if hasattr(self, "cookie_file") and self.cookie_file:
|
457
464
|
self.session.cookies.save(ignore_discard=True, ignore_expires=True)
|
458
465
|
|
459
466
|
@property
|
@@ -575,6 +582,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
575
582
|
"totp_challenge": challenge,
|
576
583
|
"expire_seconds": self._parse_duration(timeout),
|
577
584
|
},
|
585
|
+
header={self.HTTP_HEADER_JWT_set_cookie: "true"} if self.cookie_file else {},
|
578
586
|
)
|
579
587
|
if resp.status_code == HTTPStatus.OK and "access_token" in resp.json():
|
580
588
|
self.jwt_token = resp.json()["access_token"]
|
appmesh/client_tcp.py
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
# client_tcp.py
|
2
2
|
# pylint: disable=line-too-long,broad-exception-raised,broad-exception-caught,import-outside-toplevel,protected-access
|
3
3
|
|
4
|
+
# Standard library imports
|
4
5
|
import json
|
5
6
|
import os
|
6
|
-
import sys
|
7
7
|
import socket
|
8
|
+
import sys
|
8
9
|
import uuid
|
10
|
+
|
11
|
+
# Third-party imports
|
9
12
|
import requests
|
13
|
+
|
14
|
+
# Local imports
|
10
15
|
from .client_http import AppMeshClient
|
11
|
-
from .tcp_transport import TCPTransport
|
12
16
|
from .tcp_messages import RequestMessage, ResponseMessage
|
17
|
+
from .tcp_transport import TCPTransport
|
13
18
|
|
14
19
|
|
15
20
|
class AppMeshClientTCP(AppMeshClient):
|
appmesh/server_http.py
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# server_http.py
|
2
2
|
# pylint: disable=line-too-long,broad-exception-raised,broad-exception-caught,import-outside-toplevel,protected-access
|
3
3
|
|
4
|
+
# Standard library imports
|
4
5
|
import abc
|
5
6
|
import logging
|
6
7
|
import os
|
7
8
|
import time
|
8
|
-
from typing import Optional, Tuple, Union
|
9
9
|
from http import HTTPStatus
|
10
|
+
from typing import Optional, Tuple, Union
|
11
|
+
|
12
|
+
# Local imports
|
10
13
|
from .client_http import AppMeshClient
|
11
14
|
|
12
15
|
logger = logging.getLogger(__name__)
|
appmesh/server_tcp.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# server_tcp.py
|
2
2
|
# pylint: disable=line-too-long,broad-exception-raised,broad-exception-caught,import-outside-toplevel,protected-access
|
3
3
|
|
4
|
-
|
4
|
+
# Standard library imports
|
5
5
|
import logging
|
6
|
+
import os
|
6
7
|
from typing import Optional, Tuple
|
8
|
+
|
9
|
+
# Local imports
|
7
10
|
from .client_http import AppMeshClient
|
8
11
|
from .client_tcp import AppMeshClientTCP
|
9
12
|
from .server_http import AppMeshServer
|
appmesh/tcp_messages.py
CHANGED
appmesh/tcp_transport.py
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
appmesh/__init__.py,sha256=uJ5LOadwZW2nOXkSuPOy2S3WH9Bx0BUn5wUvPBeFzoc,2217
|
2
|
+
appmesh/app.py,sha256=crD4DRFZJuHtZMfSsz7C-EwvjPmGZbFXYXvA_wCdvdI,10734
|
3
|
+
appmesh/app_output.py,sha256=N8BihWhuUgPUyqZabZMKhQylk8nTHXKk6kMIdidEkGM,1061
|
4
|
+
appmesh/app_run.py,sha256=aYq852a29OThIi32Xtx5s0sTXZ97T0lHD5WXH8yfPoc,2018
|
5
|
+
appmesh/appmesh_client.py,sha256=ywB2222PtJUffdfdxZcBfdhZs1KYyc7JvzMxwuK2qyI,378
|
6
|
+
appmesh/client_http.py,sha256=FXCldfTZVU_5RSuSknlH1K2UiC6gOeotj-4NDQzdEhY,60752
|
7
|
+
appmesh/client_http_oauth.py,sha256=1d51o0JX_xtB8d2bEuM7_XJHcwMnhcjkbIq7GE1Zxm8,6120
|
8
|
+
appmesh/client_tcp.py,sha256=RX3T3OG4iOAju8ZPOnTjI_y97Y23_kWoNDjmKjtrBeU,11524
|
9
|
+
appmesh/server_http.py,sha256=wfyiIa2zC-uJR2ZNTGMjYWheqAfSRl0aAv5b_GYcwpE,4343
|
10
|
+
appmesh/server_tcp.py,sha256=J65kmN7DJftyW1LlF--S3keQ6VGmqXb778E79I1R0_k,1488
|
11
|
+
appmesh/tcp_messages.py,sha256=YB_AiMOSzN9j8oSrF0V9gD184Ugbsff-ZnezExwmvtk,1928
|
12
|
+
appmesh/tcp_transport.py,sha256=FCfTBHb9FLwMUIxZejOuH_NocHQFGaNDge57IUTJvgs,8973
|
13
|
+
appmesh-1.6.11.dist-info/METADATA,sha256=gHUSXnQdxvG61jPEUWcJBSJlrmR_PIHZ_qyyaYwTuIc,11764
|
14
|
+
appmesh-1.6.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
appmesh-1.6.11.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
16
|
+
appmesh-1.6.11.dist-info/RECORD,,
|
appmesh-1.6.10.dist-info/RECORD
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=uJ5LOadwZW2nOXkSuPOy2S3WH9Bx0BUn5wUvPBeFzoc,2217
|
2
|
-
appmesh/app.py,sha256=crD4DRFZJuHtZMfSsz7C-EwvjPmGZbFXYXvA_wCdvdI,10734
|
3
|
-
appmesh/app_output.py,sha256=vfn322AyixblI8DbXds08h6L_ybObiaRSifsA1-Xcoo,1035
|
4
|
-
appmesh/app_run.py,sha256=aYq852a29OThIi32Xtx5s0sTXZ97T0lHD5WXH8yfPoc,2018
|
5
|
-
appmesh/appmesh_client.py,sha256=ywB2222PtJUffdfdxZcBfdhZs1KYyc7JvzMxwuK2qyI,378
|
6
|
-
appmesh/client_http.py,sha256=KD4AMcMbHqaLJWSrra0J03kMqWAiwYHiyusUc5kpr6o,60443
|
7
|
-
appmesh/client_http_oauth.py,sha256=1d51o0JX_xtB8d2bEuM7_XJHcwMnhcjkbIq7GE1Zxm8,6120
|
8
|
-
appmesh/client_tcp.py,sha256=aq6UUzytZA4ibE9WQMMWdo1uW8sHETEhJjsbM6IYSno,11457
|
9
|
-
appmesh/server_http.py,sha256=rBIYO9rbR-r3x1Jcry440Sp--IM-OWKRaOhNpGdkxh8,4299
|
10
|
-
appmesh/server_tcp.py,sha256=-CU5tw97WJmDcUNsNPWqpdZ0wxRzRD6kUP3XyNZUTHc,1444
|
11
|
-
appmesh/tcp_messages.py,sha256=H9S_iCy0IuufY2v50_SUgRvcyQmJsySG65tBe_xb3Ko,1878
|
12
|
-
appmesh/tcp_transport.py,sha256=0hRSp5fpL9wKB05JIyIRIuyBC8w1IdokryhMDHqtN4M,8946
|
13
|
-
appmesh-1.6.10.dist-info/METADATA,sha256=do80dYMa4qK9tg1qKDM4M0klzIgzfcEGlWo6w1OIBfg,11764
|
14
|
-
appmesh-1.6.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
-
appmesh-1.6.10.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
16
|
-
appmesh-1.6.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|