Debug webhook receiver
This commit is contained in:
parent
6145384f04
commit
de5483107a
5
main.py
5
main.py
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
from dolibarrpy import Dolibarrpy
|
from dolibarrpy import Dolibarrpy
|
||||||
from flask import Flask, abort, request
|
from flask import Flask, abort, request
|
||||||
from ldap3 import ALL, Connection, ObjectDef, Reader, Server, WritableEntry, Writer
|
from ldap3 import ALL, Connection, ObjectDef, Reader, Server, WritableEntry, Writer
|
||||||
@ -196,6 +198,9 @@ def webhook_receiver():
|
|||||||
abort(400)
|
abort(400)
|
||||||
triggercode = data['triggercode']
|
triggercode = data['triggercode']
|
||||||
obj = data['object']
|
obj = data['object']
|
||||||
|
if config.DOLIBARR_API_DEBUG:
|
||||||
|
print("Received webhook trigger of type", triggercode, "with content:")
|
||||||
|
print(json.dumps(obj))
|
||||||
dolibarr_client = Dolibarrpy(url=config.DOLIBARR_API_BASE, token=config.DOLIBARR_API_TOKEN, timeout=16, debug=config.DOLIBARR_API_DEBUG)
|
dolibarr_client = Dolibarrpy(url=config.DOLIBARR_API_BASE, token=config.DOLIBARR_API_TOKEN, timeout=16, debug=config.DOLIBARR_API_DEBUG)
|
||||||
ldap_server = Server(config.LDAP_HOST, config.LDAP_PORT, get_info=ALL)
|
ldap_server = Server(config.LDAP_HOST, config.LDAP_PORT, get_info=ALL)
|
||||||
if triggercode.startswith('USER_'):
|
if triggercode.startswith('USER_'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user