#!/usr/local/bin/python3.9
print("Content-type:text/html\n\n")
import datetime
import cherrypy
import simplejson
path_log = '/var/www/project/tmp/HOOKS.txt'
class Root(object):
@cherrypy.expose
def index(self):
cl = cherrypy.request.headers['Content-Length']
#rawbody =
cherrypy.request.body.read(int(cl))
rawbody = cherrypy.request.body.readline()
with open(path_log, 'a') as e:
e.write(
datetime.datetime.now().strftime('%d-%m-%Y %H:%M:%S') + f' {rawbody}\n')
print(rawbody)
# return rawbody
cherrypy.config.update({
'server.socket_host' : '
0.0.0.0',
'server.socket_port' : 5000,
})
#cherrypy.quickstart(self, script_name='/')
cherrypy.quickstart(Root(), script_name='/')