cosmic-python-sdk 0.1.0__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.
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmic-python-sdk
3
+ Version: 0.1.0
4
+ Summary: Cosmic Gateway Python SDK
5
+ Home-page: https://github.com/cosmic-payment/cosmic-gateway
6
+ Author: Emmanuel Mnanka Samo
7
+ License: MIT
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: requests>=2.28
11
+
12
+ # Cosmic Python SDK
13
+
14
+ Minimal Python client for Cosmic Gateway API.
15
+
16
+ Install (PyPI):
17
+
18
+ pip install cosmic-python-sdk
19
+
20
+ Quick example:
21
+
22
+ ```py
23
+ from cosmic_sdk import CosmicGateway
24
+
25
+ client = CosmicGateway(api_key="sk_test_...")
26
+ resp = client.get('/health')
27
+ print(resp.status_code, resp.text)
28
+ ```
@@ -0,0 +1,6 @@
1
+ cosmic_sdk/__init__.py,sha256=ESNiVK0TNQIf8m2F1kPPSgwmGZ6iMnFwswN7ti672II,86
2
+ cosmic_sdk/client.py,sha256=rSTuBjVGujC6zRXAWA5le7GSDpycHlxa98XNE8A8KSA,1169
3
+ cosmic_python_sdk-0.1.0.dist-info/METADATA,sha256=C1774zIObsAUNX8ZrkkD7G78rucsrxQME7ruVYvuL68,586
4
+ cosmic_python_sdk-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ cosmic_python_sdk-0.1.0.dist-info/top_level.txt,sha256=WXeTQ58vBF53WDaeXmo0QCVB-XuMNa2q5b-hVsvGDE4,11
6
+ cosmic_python_sdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ cosmic_sdk
cosmic_sdk/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .client import CosmicGateway
2
+
3
+ __all__ = ["CosmicGateway"]
4
+
5
+ __version__ = "0.1.0"
cosmic_sdk/client.py ADDED
@@ -0,0 +1,31 @@
1
+ import requests
2
+ from typing import Optional, Dict, Any
3
+
4
+
5
+ class CosmicGateway:
6
+ """Simple HTTP client for Cosmic Gateway"""
7
+
8
+ def __init__(self, api_key: str, base_url: str = "https://api.cosmicgateway.com"):
9
+ self.api_key = api_key
10
+ self.base_url = base_url.rstrip("/")
11
+ self.session = requests.Session()
12
+ self.session.headers.update(self._default_headers())
13
+
14
+ def _default_headers(self) -> Dict[str, str]:
15
+ return {
16
+ "Authorization": f"Bearer {self.api_key}",
17
+ "Accept": "application/json",
18
+ "User-Agent": "cosmic-python-sdk/0.1.0",
19
+ }
20
+
21
+ def get(self, path: str, params: Optional[Dict[str, Any]] = None) -> requests.Response:
22
+ url = f"{self.base_url}{path if path.startswith('/') else '/' + path}"
23
+ return self.session.get(url, params=params)
24
+
25
+ def post(self, path: str, json: Optional[Dict[str, Any]] = None) -> requests.Response:
26
+ url = f"{self.base_url}{path if path.startswith('/') else '/' + path}"
27
+ return self.session.post(url, json=json)
28
+
29
+ # convenience method
30
+ def health(self) -> requests.Response:
31
+ return self.get('/health')