mgraph-ai-service-cache-client 0.1.3__py3-none-any.whl → 0.1.4__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 mgraph-ai-service-cache-client might be problematic. Click here for more details.
- mgraph_ai_service_cache_client/client/Cache__Client.py +6 -0
- mgraph_ai_service_cache_client/client/Cache__Client__Config.py +7 -0
- mgraph_ai_service_cache_client/client/Cache__Client__Health_Checks.py +25 -0
- mgraph_ai_service_cache_client/client/Cache__Client__Requests.py +38 -0
- mgraph_ai_service_cache_client/client/__init__.py +0 -0
- mgraph_ai_service_cache_client/schemas/client/Cache__Client__Requests__Result.py +26 -0
- mgraph_ai_service_cache_client/schemas/client/health_checks/Cache__Client__Health_Checks__Status.py +11 -0
- mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Gone.py +2 -2
- mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Not_Found.py +4 -4
- mgraph_ai_service_cache_client/version +1 -1
- {mgraph_ai_service_cache_client-0.1.3.dist-info → mgraph_ai_service_cache_client-0.1.4.dist-info}/METADATA +2 -2
- {mgraph_ai_service_cache_client-0.1.3.dist-info → mgraph_ai_service_cache_client-0.1.4.dist-info}/RECORD +14 -7
- {mgraph_ai_service_cache_client-0.1.3.dist-info → mgraph_ai_service_cache_client-0.1.4.dist-info}/LICENSE +0 -0
- {mgraph_ai_service_cache_client-0.1.3.dist-info → mgraph_ai_service_cache_client-0.1.4.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
2
|
+
from osbot_utils.type_safe.primitives.domains.web.safe_str.Safe_Str__Url import Safe_Str__Url
|
|
3
|
+
|
|
4
|
+
URL__TARGET_SERVER__DEV = "https://cache.dev.mgraph.ai"
|
|
5
|
+
|
|
6
|
+
class Cache__Client__Config(Type_Safe):
|
|
7
|
+
target_server : Safe_Str__Url = URL__TARGET_SERVER__DEV
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
|
|
2
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
3
|
+
from osbot_utils.utils.Misc import list_set
|
|
4
|
+
from mgraph_ai_service_cache_client.client.Cache__Client__Config import Cache__Client__Config
|
|
5
|
+
from mgraph_ai_service_cache_client.client.Cache__Client__Requests import Cache__Client__Requests
|
|
6
|
+
from mgraph_ai_service_cache_client.schemas.client.health_checks.Cache__Client__Health_Checks__Status import Cache__Client__Health_Checks__Status
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Cache__Client__Health_Checks(Type_Safe):
|
|
10
|
+
config : Cache__Client__Config
|
|
11
|
+
|
|
12
|
+
@cache_on_self
|
|
13
|
+
def client__requests(self):
|
|
14
|
+
return Cache__Client__Requests(config=self.config)
|
|
15
|
+
|
|
16
|
+
def check__target_server__status(self):
|
|
17
|
+
path = "/openapi.json" # in Fast_API this endpoint has no auth
|
|
18
|
+
result = self.client__requests().get(path)
|
|
19
|
+
openapi_json = result.json
|
|
20
|
+
success = list_set(openapi_json) == ['components', 'info', 'openapi', 'paths']
|
|
21
|
+
|
|
22
|
+
status_kwargs = dict(duration = result.duration ,
|
|
23
|
+
success = success ,
|
|
24
|
+
target_server = self.config.target_server)
|
|
25
|
+
return Cache__Client__Health_Checks__Status(**status_kwargs)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from osbot_utils.helpers.duration.decorators.capture_duration import capture_duration
|
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
4
|
+
from osbot_utils.utils.Http import url_join_safe
|
|
5
|
+
from mgraph_ai_service_cache_client.client.Cache__Client__Config import Cache__Client__Config
|
|
6
|
+
from mgraph_ai_service_cache_client.schemas.client.Cache__Client__Requests__Result import Cache__Client__Requests__Result
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Cache__Client__Requests(Type_Safe):
|
|
10
|
+
config: Cache__Client__Config
|
|
11
|
+
|
|
12
|
+
def auth_headers(self):
|
|
13
|
+
return {}
|
|
14
|
+
|
|
15
|
+
def headers(self):
|
|
16
|
+
return { **self.auth_headers() } # location to add more requests headers (if needed)
|
|
17
|
+
|
|
18
|
+
def get(self, path):
|
|
19
|
+
target_server = self.config.target_server
|
|
20
|
+
url = url_join_safe(target_server, path)
|
|
21
|
+
headers = self.auth_headers()
|
|
22
|
+
with capture_duration() as duration:
|
|
23
|
+
response = requests.get(url, headers=headers)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
content_type = response.headers.get('content-type')
|
|
27
|
+
result_kwargs = dict(content_type = content_type ,
|
|
28
|
+
duration = duration.seconds ,
|
|
29
|
+
path = path ,
|
|
30
|
+
status_code = response.status_code,
|
|
31
|
+
target_server = target_server )
|
|
32
|
+
|
|
33
|
+
if 'json' in content_type: result_kwargs['json' ] = response.json()
|
|
34
|
+
elif 'text' in content_type: result_kwargs['text' ] = response.text
|
|
35
|
+
else: result_kwargs['content'] = response.content
|
|
36
|
+
|
|
37
|
+
return Cache__Client__Requests__Result(**result_kwargs)
|
|
38
|
+
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
3
|
+
from osbot_utils.type_safe.primitives.core.Safe_Float import Safe_Float
|
|
4
|
+
from osbot_utils.type_safe.primitives.core.Safe_UInt import Safe_UInt
|
|
5
|
+
from osbot_utils.type_safe.primitives.domains.common.safe_str.Safe_Str__Text import Safe_Str__Text
|
|
6
|
+
from osbot_utils.type_safe.primitives.domains.files.safe_str.Safe_Str__File__Path import Safe_Str__File__Path
|
|
7
|
+
from osbot_utils.type_safe.primitives.domains.http.safe_str.Safe_Str__Http__Content_Type import Safe_Str__Http__Content_Type
|
|
8
|
+
from osbot_utils.type_safe.primitives.domains.http.safe_str.Safe_Str__Http__Text import Safe_Str__Http__Text
|
|
9
|
+
from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now import Timestamp_Now
|
|
10
|
+
from osbot_utils.type_safe.primitives.domains.web.safe_str.Safe_Str__Url import Safe_Str__Url
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Cache__Client__Requests__Result(Type_Safe):
|
|
14
|
+
content_type : Safe_Str__Http__Content_Type
|
|
15
|
+
content : bytes = None
|
|
16
|
+
duration : Safe_Float
|
|
17
|
+
error : Safe_Str__Text
|
|
18
|
+
json : Dict = None
|
|
19
|
+
path : Safe_Str__File__Path
|
|
20
|
+
status_code : Safe_UInt
|
|
21
|
+
target_server : Safe_Str__Url
|
|
22
|
+
text : Safe_Str__Http__Text = None # this has 1M limit, which should be ok for all use-cases (that return text)
|
|
23
|
+
timestamp : Timestamp_Now
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
mgraph_ai_service_cache_client/schemas/client/health_checks/Cache__Client__Health_Checks__Status.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
2
|
+
from osbot_utils.type_safe.primitives.core.Safe_Float import Safe_Float
|
|
3
|
+
from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now import Timestamp_Now
|
|
4
|
+
from osbot_utils.type_safe.primitives.domains.web.safe_str.Safe_Str__Url import Safe_Str__Url
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Cache__Client__Health_Checks__Status(Type_Safe):
|
|
8
|
+
duration : Safe_Float
|
|
9
|
+
success : bool
|
|
10
|
+
target_server: Safe_Str__Url
|
|
11
|
+
timestamp : Timestamp_Now
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from osbot_utils.type_safe.primitives.core.Safe_UInt import Safe_UInt
|
|
2
2
|
from osbot_utils.type_safe.primitives.domains.identifiers.Random_Guid import Random_Guid
|
|
3
|
-
from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now
|
|
3
|
+
from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now import Timestamp_Now
|
|
4
4
|
from osbot_utils.type_safe.primitives.domains.identifiers.safe_str.Safe_Str__Id import Safe_Str__Id
|
|
5
|
-
from mgraph_ai_service_cache_client.schemas.errors.Schema__Cache__Error__Base
|
|
5
|
+
from mgraph_ai_service_cache_client.schemas.errors.Schema__Cache__Error__Base import Schema__Cache__Error__Base
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Schema__Cache__Error__Gone(Schema__Cache__Error__Base): # 410 Gone errors (expired entries)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from osbot_utils.type_safe.primitives.domains.identifiers.Random_Guid
|
|
2
|
-
from osbot_utils.type_safe.primitives.domains.identifiers.safe_str.Safe_Str__Id
|
|
3
|
-
from osbot_utils.type_safe.primitives.domains.cryptography.safe_str.Safe_Str__Cache_Hash
|
|
4
|
-
from mgraph_ai_service_cache_client.schemas.errors.Schema__Cache__Error__Base
|
|
1
|
+
from osbot_utils.type_safe.primitives.domains.identifiers.Random_Guid import Random_Guid
|
|
2
|
+
from osbot_utils.type_safe.primitives.domains.identifiers.safe_str.Safe_Str__Id import Safe_Str__Id
|
|
3
|
+
from osbot_utils.type_safe.primitives.domains.cryptography.safe_str.Safe_Str__Cache_Hash import Safe_Str__Cache_Hash
|
|
4
|
+
from mgraph_ai_service_cache_client.schemas.errors.Schema__Cache__Error__Base import Schema__Cache__Error__Base
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class Schema__Cache__Error__Not_Found(Schema__Cache__Error__Base): # 404 Not Found errors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
v0.1.
|
|
1
|
+
v0.1.4
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mgraph_ai_service_cache__client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: MGraph-AI__Service__Cache__Client
|
|
5
5
|
Home-page: https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client
|
|
6
6
|
License: Apache 2.0
|
|
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|
|
|
17
17
|
# MGraph AI Service Cache Client
|
|
18
18
|
|
|
19
|
-
[](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/releases)
|
|
20
20
|
[](https://www.python.org/downloads/)
|
|
21
21
|
[](https://fastapi.tiangolo.com/)
|
|
22
22
|
[](https://aws.amazon.com/lambda/)
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
mgraph_ai_service_cache_client/__init__.py,sha256=vV-3_LTA0gOaz_M_rug9AA7UQ6vMFo35MolQSywHS-4,74
|
|
2
|
+
mgraph_ai_service_cache_client/client/Cache__Client.py,sha256=fdfMSe86BzcNMmPIWalAeQUCdWgHa_dho0xEJ4c2tGY,244
|
|
3
|
+
mgraph_ai_service_cache_client/client/Cache__Client__Config.py,sha256=HY9ZwlQUR562l_SMeZSEd3G48TB9M-k4AdN81Nbrtjw,341
|
|
4
|
+
mgraph_ai_service_cache_client/client/Cache__Client__Health_Checks.py,sha256=wjTQltslff3779ONQt68xQxcSLGiak80TeHNbkbjBGo,1597
|
|
5
|
+
mgraph_ai_service_cache_client/client/Cache__Client__Requests.py,sha256=_2scv2ugy0IDFxnl2zuaR4yD8SmAWWW_Vk7b9_ecAzk,1837
|
|
6
|
+
mgraph_ai_service_cache_client/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
7
|
mgraph_ai_service_cache_client/config.py,sha256=JmUXxVA2PmuPzv39_0751dswVYyUtrzAjVr1JFnso-s,356
|
|
3
8
|
mgraph_ai_service_cache_client/fast_api/Cache_Client__Fast_API.py,sha256=iYUqCYKemXJPpSVDYJ5VAxcAZEqMIK5Q6CaWZ5uSGPE,526
|
|
4
9
|
mgraph_ai_service_cache_client/fast_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -54,14 +59,16 @@ mgraph_ai_service_cache_client/schemas/cache/zip/enums/__init__.py,sha256=47DEQp
|
|
|
54
59
|
mgraph_ai_service_cache_client/schemas/cache/zip/safe_str/Safe_Str__Cache__Zip__Operation__Message.py,sha256=-suUNhS4cDSG1yxo3xfIsyEspAi-aCAxe0w5zh9gHfE,186
|
|
55
60
|
mgraph_ai_service_cache_client/schemas/cache/zip/safe_str/Safe_Str__Cache__Zip__Operation__Pattern.py,sha256=f1eRRvKBfb2JWVTWKMZGdhDDh2Kp0XsGcUoYu05165I,183
|
|
56
61
|
mgraph_ai_service_cache_client/schemas/cache/zip/safe_str/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
+
mgraph_ai_service_cache_client/schemas/client/Cache__Client__Requests__Result.py,sha256=2G40_hgXF1a3qGMoy_iVNOFBngfITyujU5qhtwI39r0,1688
|
|
63
|
+
mgraph_ai_service_cache_client/schemas/client/health_checks/Cache__Client__Health_Checks__Status.py,sha256=mUeBIpClnXIZZf-58_ZtBRyG5wsO_Se7KaPR-5zFMso,578
|
|
57
64
|
mgraph_ai_service_cache_client/schemas/consts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
65
|
mgraph_ai_service_cache_client/schemas/consts/const__Fast_API.py,sha256=XMS7VWZJ1gAspr7ZtTS0eIcGG96P6LFyxuqA7skTxfQ,890
|
|
59
66
|
mgraph_ai_service_cache_client/schemas/consts/const__Storage.py,sha256=hZMbog7F2273BuCkG3apFU7U1vuZylThmrUcXHapQG0,302
|
|
60
67
|
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Base.py,sha256=KLxodtsKWXSgvIaoPoOPYLr8OvuTQjmGN4l7orHBqxE,1060
|
|
61
68
|
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Conflict.py,sha256=xAv0HfJ0Y6BhGsEPWgzRqulSSni5tBDGnGrQtXRmY68,950
|
|
62
|
-
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Gone.py,sha256=
|
|
69
|
+
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Gone.py,sha256=pj-aeVI_RGMKKY95GRngDKjU1aTL0qZa1N57JzyFcGs,1068
|
|
63
70
|
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Invalid_Input.py,sha256=cX2RT9yN7TrkOvitLRXbUauRC5ZROP89uIjM3Agw8-A,1035
|
|
64
|
-
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Not_Found.py,sha256=
|
|
71
|
+
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Not_Found.py,sha256=2wY3q8mmFgBroXVORK90l5TsqD5baTwlrpNBVRHyLPU,1087
|
|
65
72
|
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Service_Unavailable.py,sha256=702J_ax38PweqZb9LSpy5KjxhjbC7aalPcagpAIYtkY,823
|
|
66
73
|
mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Unsupported_Media_Type.py,sha256=DMtj63CGMG3UV2nCdcMx0ANDDspRAr8FaDpLDCuSPXU,1073
|
|
67
74
|
mgraph_ai_service_cache_client/schemas/errors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -74,8 +81,8 @@ mgraph_ai_service_cache_client/service/info/schemas/Schema__Service__Status.py,s
|
|
|
74
81
|
mgraph_ai_service_cache_client/utils/Version.py,sha256=-iKgWjUzrm9eGMdLFsvKPuxZFckmfNE5Y5bw6vSydhY,797
|
|
75
82
|
mgraph_ai_service_cache_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
83
|
mgraph_ai_service_cache_client/utils/deploy/Deploy__Service.py,sha256=iBqB4km1H3eHPXPfyh7UajjHMKom684S9ACGUa13vw4,816
|
|
77
|
-
mgraph_ai_service_cache_client/version,sha256=
|
|
78
|
-
mgraph_ai_service_cache_client-0.1.
|
|
79
|
-
mgraph_ai_service_cache_client-0.1.
|
|
80
|
-
mgraph_ai_service_cache_client-0.1.
|
|
81
|
-
mgraph_ai_service_cache_client-0.1.
|
|
84
|
+
mgraph_ai_service_cache_client/version,sha256=RdHCtpq0XxnJ1hnEYircEBXJqJnD3rbZSAU9JWi6NtM,7
|
|
85
|
+
mgraph_ai_service_cache_client-0.1.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
86
|
+
mgraph_ai_service_cache_client-0.1.4.dist-info/METADATA,sha256=vrvimMmHW_6MPzH8RhEK38Jz6DjUfRQ-sRJNW_Bq7hg,9846
|
|
87
|
+
mgraph_ai_service_cache_client-0.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
88
|
+
mgraph_ai_service_cache_client-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|