Third party python libraries

let’s face it: we’re dealing with a very good framework.
In no way am I experienced enough to deal with all of it’s abillities.


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:
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:

...'func', {'some_string': 'string'} 
.then(r => {
        if (r) {
            let data = r;
            // do something with data

Is it at all possible?


1 Like

thanks I’ll try this

tried a simple script:

def test():
        return 'Success!'

and got:

Failed to get method for command with name ‘frappe’ is not defined


import frappe

Thanks! :slight_smile: