I instantiate and register WebManager as part of my app. I'm running a workflow and web app together. Everything works find, except for getting POST data.
class WebSite(Controller):
def index(self):
return "Hello World!"
def detail(self, id):
return "Web ID: {}".format(id)
class WebService(Controller):
channel = "/WebService"
def POST(self, *args, **kwargs):
return str(args) + ' ' + str(kwargs) + ' ' + 'Why are these empty?'
class WebManager(Component):
def init(self):
Server(('0.0.0.0', 80)).register(self)
WebSite(self).register(self)
WebService(self).register(self)
Using the following to call:
import requests
r = requests.get('http://localhost')
print(r.text)
# Output: Hello World!
r = requests.get('http://localhost/detail?id=12')
print(r.text)
# Output: Web ID: 12
r = requests.post('http://localhost/WebService', json={'bob': 1, 'joe': {'blue': 43}})
print(r.text)
# Output: () {} Why are these empty?
I been through the docs and can't figure out how I get the body data of the post. I assumed it would be passed in as one of the arguments. I've also stopped in PyCharm debugger and looked through the self object of WebService and see nothing.