First,
let’s face it: we’re dealing with a very good framework.
Second,
In no way am I experienced enough to deal with all of it’s abillities.
SO!
I really need help with an idea I been playing with, but can’t figure out how to do.
The thing is, it requires me implementing a python function. This function requires different libraries loaded in order to work (e.g. requests).
As I understand I need a whitelist function (not sure, but stay with me here…)
So let’s say I created a DocType named Test
and it needs the python function, which requires the requests
library imported how do I do this?
I will try to be more specific
I want to create a new file:
~/frappe-bench/apps/my_app/my_app/my_app/doctype/test/test_fun.py
inside I want it to have the following code:
import requests
def func(some_string)
r = requests.get(some_string, some_args)`
return r.text
and then I want to be able to have a client script that performs:
...
frm.call('func', {'some_string': 'string'}
.then(r => {
if (r) {
let data = r;
// do something with data
}
})
Is it at all possible?