File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ value should be checked prior to accepting the webhook.
21
21
This value is generated by computing a SHA256 HMAC hash of the body of the webhook. The secret to verify with will be provided to you as part
22
22
of the setup process.
23
23
24
- <Tabs items = { [' Node.js' ]} >
24
+ <Tabs items = { [' Node.js' , ' Python ' ]} >
25
25
<Tab >
26
26
``` javascript
27
27
const signatureSecret = process .env .LUNAR_CLIENT_WEBHOOK_SECRET ;
@@ -33,6 +33,22 @@ of the setup process.
33
33
.digest (" hex" );
34
34
```
35
35
</Tab >
36
+ <Tab >
37
+ ``` python
38
+ import os
39
+ import hmac
40
+ import hashlib
41
+
42
+ signature_secret = os.getenv(' LUNAR_CLIENT_WEBHOOK_SECRET' )
43
+ body = ... # This must be the raw body of the webhook. Parsing as JSON and re-serializing can create differences in whitespace.
44
+
45
+ expected_signature = hmac.new(
46
+ signature_secret.encode(' utf-8' ),
47
+ body.encode(' utf-8' ),
48
+ hashlib.sha256
49
+ ).hexdigest()
50
+ ```
51
+ </Tab >
36
52
</Tabs >
37
53
38
54
## Webhook Types
You can’t perform that action at this time.
0 commit comments