Miah Thompson Miah Thompson - 11 months ago 84
HTML Question

How do you pass variables using a HTTP post from a JS file/function to a separate python file/function hosted somewhere else?

I have JS running and essentially getting user entries from my HTML session storage and pushing these to a DB. I also need to use a HTTP request to pass a json object containing the entries to a python file hosted somewhere else.

Does anyone have any idea of documentation I could look at, or perhaps how to get JSON objects from JS to Python.

My client does not want me to grab the variables directly from the DB.

Answer Source

You have to create a communication channel between the javascript code and the python. This could be anything, SOAP, HTTP, RPC, any number of and flavor of message queue.

If nothing like that is in place, it's quite the long way around. A complex application might warrant you doing this. Perhaps that's why your client is asking.

Firebase is a real-time database that already has many of the characteristics of a queue. You already have Firebase! The simplest and most idiomatic thing to do would be to let the python code be notified of changes by Firebase.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download