pydiagral 1.0.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pydiagral/__init__.py +28 -0
- pydiagral/api.py +1249 -0
- pydiagral/constants.py +4 -0
- pydiagral/exceptions.py +39 -0
- pydiagral/models.py +1498 -0
- pydiagral/utils.py +14 -0
- pydiagral-1.0.0.dist-info/METADATA +828 -0
- pydiagral-1.0.0.dist-info/RECORD +10 -0
- pydiagral-1.0.0.dist-info/WHEEL +4 -0
- pydiagral-1.0.0.dist-info/licenses/LICENSE +674 -0
pydiagral/utils.py
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
"""Module providing utility functions for Diagral API."""
|
2
|
+
|
3
|
+
import hashlib
|
4
|
+
import hmac
|
5
|
+
import time
|
6
|
+
|
7
|
+
|
8
|
+
def generate_hmac_signature(
|
9
|
+
timestamp: str, serial_id: str, api_key: str, secret_key: str
|
10
|
+
) -> str:
|
11
|
+
"""Generate an HMAC signature for the given parameters."""
|
12
|
+
timestamp = str(int(time.time()))
|
13
|
+
message = f"{timestamp}.{serial_id}.{api_key}"
|
14
|
+
return hmac.new(secret_key.encode(), message.encode(), hashlib.sha256).hexdigest()
|