MCPcopy Create free account
hub / github.com/Roy3838/Observer / _get_client

Function _get_client

api/r2_store.py:43–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42
43def _get_client():
44 global _client
45 if _client is not None:
46 return _client
47
48 if not all([R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY]):
49 raise RuntimeError("R2 credentials are not configured (R2_ACCOUNT_ID / R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY)")
50
51 _client = boto3.client(
52 "s3",
53 endpoint_url=f"https://{R2_ACCOUNT_ID}.r2.cloudflarestorage.com",
54 aws_access_key_id=R2_ACCESS_KEY_ID,
55 aws_secret_access_key=R2_SECRET_ACCESS_KEY,
56 region_name="auto",
57 config=Config(retries={"max_attempts": 3, "mode": "standard"}),
58 )
59 return _client
60
61
62def _get_json_sync(key: str) -> Tuple[Optional[dict], Optional[str]]:

Callers 5

_get_json_syncFunction · 0.85
_put_json_syncFunction · 0.85
_put_bytes_syncFunction · 0.85
_get_bytes_syncFunction · 0.85
_delete_syncFunction · 0.85

Calls 1

ConfigClass · 0.90

Tested by

no test coverage detected