Is it possible to call Python API function in Mendix Studio Pro

0
Hello experts,   I want to develop a Mendix demo for patent search. In the demo, it has the input text which the user can input keywords and the output to show the result. The search function will use the Python API  which patent company supply, I want to know whether the Python API function can be called in Mendix Studio Pro, could you please give an example? Thank you very much!   Best Regards, Zhaohong    
asked
3 answers
1

This is a very uncommon scenario. It is possible but it would involve creating Java actions that execute the Python API. This is possible using Jython but only if the API is written for Python 2.7. It would be a massive overhead IMHO. It would involve loading the Jython interpreter, then load all the Python files needed for the API, and then creating Java actions for all the functions you would want to use in your Microflows. 

Assuming the patent company is exposing this search functionality over the web, it would be simpler to re-implement the API using native Mendix functionality. Since the API is written in Python, it would be simple enough to reverse-engineer it. 

If you really want to use Python in Mendix, you can use this website for inspiration

 

 

answered
0

Do you mean they only provide a client library for access to their data?

It is probably using something like REST behind the scenes so you can look at the Python code and see if that is the case. If it is, you can use Mendix’s REST functionality to query their data. 

If they aren’t using REST, you are probably looking at trying to reverse engineer their Python code.

answered
0

Thank you very much for your help. Now I am trying to call Java action in the microflow, and then call the Python API in java code.  But another issue is how to get the value from text box and how to set the value to the listview in GUI.

I want to get the key words from text box, call the python API to search in patent server, and show the patent result in listview,  the result type including : words, picture and pdf document. Is it possible to do it and how to interact with GUI in the java ? Is there any advice and demo? Thanks in advance!

answered