kirimel-python 2.0.0__py3-none-any.whl → 2.0.2__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.
- kirimel/client.py +8 -8
- kirimel/loyalty_http_client.py +9 -9
- kirimel/resources/loyalty/customers.py +12 -0
- {kirimel_python-2.0.0.dist-info → kirimel_python-2.0.2.dist-info}/METADATA +3 -3
- {kirimel_python-2.0.0.dist-info → kirimel_python-2.0.2.dist-info}/RECORD +8 -8
- {kirimel_python-2.0.0.dist-info → kirimel_python-2.0.2.dist-info}/WHEEL +0 -0
- {kirimel_python-2.0.0.dist-info → kirimel_python-2.0.2.dist-info}/licenses/LICENSE +0 -0
- {kirimel_python-2.0.0.dist-info → kirimel_python-2.0.2.dist-info}/top_level.txt +0 -0
kirimel/client.py
CHANGED
|
@@ -43,8 +43,8 @@ class KiriMel:
|
|
|
43
43
|
base_url: str = "https://kirimel.com/api",
|
|
44
44
|
timeout: int = 30,
|
|
45
45
|
retries: int = 3,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
loyalty_api_key: Optional[str] = None,
|
|
47
|
+
key_secret: Optional[str] = None,
|
|
48
48
|
):
|
|
49
49
|
"""
|
|
50
50
|
Create a new API client
|
|
@@ -54,8 +54,8 @@ class KiriMel:
|
|
|
54
54
|
base_url: Base URL (default: https://kirimel.com/api)
|
|
55
55
|
timeout: Request timeout in seconds (default: 30)
|
|
56
56
|
retries: Number of retries (default: 3)
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
loyalty_api_key: Loyalty API key (or use KIRIMEL_LOYALTY_API_KEY env var)
|
|
58
|
+
key_secret: Loyalty API key secret (or use KIRIMEL_LOYALTY_KEY_SECRET env var)
|
|
59
59
|
"""
|
|
60
60
|
self._http_client = HttpClient(
|
|
61
61
|
api_key=api_key,
|
|
@@ -84,8 +84,8 @@ class KiriMel:
|
|
|
84
84
|
|
|
85
85
|
# Store credentials for lazy initialization
|
|
86
86
|
self._loyalty_base_url = base_url.replace("/api", "")
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
87
|
+
self._loyalty_api_key = loyalty_api_key or os.getenv("KIRIMEL_LOYALTY_API_KEY")
|
|
88
|
+
self._loyalty_key_secret = key_secret or os.getenv("KIRIMEL_LOYALTY_KEY_SECRET")
|
|
89
89
|
self._loyalty_timeout = timeout
|
|
90
90
|
self._loyalty_retries = retries
|
|
91
91
|
|
|
@@ -93,8 +93,8 @@ class KiriMel:
|
|
|
93
93
|
"""Initialize loyalty HTTP client (lazy initialization)"""
|
|
94
94
|
if self._loyalty_http_client is None:
|
|
95
95
|
self._loyalty_http_client = LoyaltyHttpClient(
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
api_key=self._loyalty_api_key,
|
|
97
|
+
key_secret=self._loyalty_key_secret,
|
|
98
98
|
base_url=self._loyalty_base_url,
|
|
99
99
|
timeout=self._loyalty_timeout,
|
|
100
100
|
retries=self._loyalty_retries,
|
kirimel/loyalty_http_client.py
CHANGED
|
@@ -21,22 +21,22 @@ class LoyaltyHttpClient:
|
|
|
21
21
|
|
|
22
22
|
def __init__(
|
|
23
23
|
self,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
api_key: Optional[str] = None,
|
|
25
|
+
key_secret: Optional[str] = None,
|
|
26
26
|
base_url: str = "https://kirimel.com",
|
|
27
27
|
timeout: int = 30,
|
|
28
28
|
retries: int = 3,
|
|
29
29
|
):
|
|
30
30
|
self.base_url = base_url.rstrip("/")
|
|
31
|
-
self.
|
|
32
|
-
self.
|
|
31
|
+
self.api_key = api_key or os.getenv("KIRIMEL_LOYALTY_API_KEY") or ""
|
|
32
|
+
self.key_secret = key_secret or os.getenv("KIRIMEL_LOYALTY_KEY_SECRET") or ""
|
|
33
33
|
self.timeout = timeout
|
|
34
34
|
self.retries = retries
|
|
35
35
|
|
|
36
|
-
if not self.
|
|
36
|
+
if not self.api_key or not self.key_secret:
|
|
37
37
|
raise AuthenticationException(
|
|
38
|
-
"Loyalty API requires both
|
|
39
|
-
"Set
|
|
38
|
+
"Loyalty API requires both api_key and key_secret. "
|
|
39
|
+
"Set KIRIMEL_LOYALTY_API_KEY and KIRIMEL_LOYALTY_KEY_SECRET environment variables, "
|
|
40
40
|
"or pass them in the config."
|
|
41
41
|
)
|
|
42
42
|
|
|
@@ -86,7 +86,7 @@ class LoyaltyHttpClient:
|
|
|
86
86
|
"Content-Type": "application/json",
|
|
87
87
|
"Accept": "application/json",
|
|
88
88
|
"User-Agent": "KiriMel-Python-SDK/2.0.0",
|
|
89
|
-
"X-
|
|
89
|
+
"X-API-Key": self.api_key,
|
|
90
90
|
"X-Timestamp": timestamp,
|
|
91
91
|
"X-Signature": signature,
|
|
92
92
|
}
|
|
@@ -119,7 +119,7 @@ class LoyaltyHttpClient:
|
|
|
119
119
|
"""Calculate HMAC SHA256 signature"""
|
|
120
120
|
signing_string = f"{timestamp}.{payload}"
|
|
121
121
|
signature = hmac.new(
|
|
122
|
-
self.
|
|
122
|
+
self.key_secret.encode(), # type: ignore[arg-type]
|
|
123
123
|
signing_string.encode(),
|
|
124
124
|
hashlib.sha256,
|
|
125
125
|
).hexdigest()
|
|
@@ -33,6 +33,18 @@ class Customers:
|
|
|
33
33
|
"""
|
|
34
34
|
return self._http.post("/api/loyalty/customers/lookup", data)
|
|
35
35
|
|
|
36
|
+
def lookup_by_email(self, email: str) -> Dict[str, Any]:
|
|
37
|
+
"""
|
|
38
|
+
Look up customer by email address
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
email: Customer email address
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
Customer data
|
|
45
|
+
"""
|
|
46
|
+
return self._http.get("/api/loyalty/customers/lookup-by-email", {"email": email})
|
|
47
|
+
|
|
36
48
|
def get(self, customer_id: str) -> Dict[str, Any]:
|
|
37
49
|
"""
|
|
38
50
|
Get customer profile
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kirimel-python
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Official KiriMel Python SDK
|
|
5
5
|
Author-email: KiriMel <support@kirimel.com>
|
|
6
6
|
License: MIT
|
|
@@ -526,8 +526,8 @@ client = kirimel.KiriMel(api_key='sk_test_xxx')
|
|
|
526
526
|
# Loyalty API credentials (optional - only if using loyalty features)
|
|
527
527
|
client = kirimel.KiriMel(
|
|
528
528
|
api_key='sk_test_xxx',
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
loyalty_api_key='kl_test_xxx', # Or KIRIMEL_LOYALTY_API_KEY env var
|
|
530
|
+
key_secret='your_secret_here' # Or KIRIMEL_LOYALTY_KEY_SECRET env var
|
|
531
531
|
)
|
|
532
532
|
```
|
|
533
533
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
kirimel/__init__.py,sha256=ia5F3-qaspNslhFA6H8yByH0MkXXxXw5IgiBmmFwkwM,390
|
|
2
|
-
kirimel/client.py,sha256=
|
|
2
|
+
kirimel/client.py,sha256=hfeTi3cz0pylQnnyc5MFnWKYgapgZqWtn4SI3b3BFG8,7075
|
|
3
3
|
kirimel/exceptions.py,sha256=YZXcjftCZOEgAIZCRsCRv9AuMcc4_OwBUUwwEvfOGqI,1137
|
|
4
4
|
kirimel/http_client.py,sha256=3cJUxIURWCn3Odm1pofu6vWjupu4jbjXNNk5zA6CTwg,4677
|
|
5
|
-
kirimel/loyalty_http_client.py,sha256=
|
|
5
|
+
kirimel/loyalty_http_client.py,sha256=A00nME9d_efUY8azA1RSB-j4Q1SVFFvAVnsJGiVEWbM,4875
|
|
6
6
|
kirimel/resources/__init__.py,sha256=7hlWWUQ0VtKQB-LMX5LPjuJW_eoeLWmWfr-oG84Ee7Q,20343
|
|
7
7
|
kirimel/resources/loyalty/__init__.py,sha256=hNgkY2sxiaPtFIVVyKouhZXHSncP9VuRTVPtbVyxTeE,204
|
|
8
|
-
kirimel/resources/loyalty/customers.py,sha256=
|
|
8
|
+
kirimel/resources/loyalty/customers.py,sha256=6fprNOCZ1BXM5BiAcWQjp9DQ6iCcpsuhp0j3WOEUuDs,2907
|
|
9
9
|
kirimel/resources/loyalty/points.py,sha256=3m5YLtoFkPLTYShoSwzDqaFzKB7G0ucrR4qluXrcWys,1608
|
|
10
10
|
kirimel/resources/loyalty/vouchers.py,sha256=vRTqzTNRTuixlkPP-FKaTrZIc4sovKTk48thtxYm0g8,1831
|
|
11
11
|
kirimel/resources/loyalty/wallet.py,sha256=QYbVKJX15zUPzMyKb3hKPKdwF5PcpsERAvvcApMKukE,852
|
|
12
|
-
kirimel_python-2.0.
|
|
13
|
-
kirimel_python-2.0.
|
|
14
|
-
kirimel_python-2.0.
|
|
15
|
-
kirimel_python-2.0.
|
|
16
|
-
kirimel_python-2.0.
|
|
12
|
+
kirimel_python-2.0.2.dist-info/licenses/LICENSE,sha256=7Om6VWyG3CquT1oA7zTeIhMJMzzO1mAyHI2T_1RRxFE,1064
|
|
13
|
+
kirimel_python-2.0.2.dist-info/METADATA,sha256=QhMzPx_0pGMaVZL7WONXdDTlo6-0u3bBgpEzDaQpOds,16003
|
|
14
|
+
kirimel_python-2.0.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
15
|
+
kirimel_python-2.0.2.dist-info/top_level.txt,sha256=8bso5h6_Im2tu-GdN4MRfXGDPR7qJ51o0-XusPi_ZI8,8
|
|
16
|
+
kirimel_python-2.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|