I have created a rest API service and code is running fine over the server.
I was wondering if there is a way through which we can send the python objects instead of the string, tuple, Response instance, or WSGI callable.
this python object contains the data inside them also.
Here is code for reference:
from flask import Flask , request , jsonify
import requests
app = Flask(__name__)
def fun(path1):
data = ''
with open(path1) as f:
data = f.read()
return data
@app.route('/client',methods=['POST'])
def client():
data = request.get_json()
path1 = data['loc']
return fun(path1)
I was just wondering instead of data
I should receive fun
object. so that I can process in my local system in an application (pyqt) and do other task using this.
Note. what this question added by that these solve my query, I already did the problem using rest API by processing. what I am asking can I sent the object which I process on the server can be sent over rest API to my machine.
Note. what this question added by that these solve my query, I already did the problem using rest API by processing. what I am asking can I sent the object which I process on the server can be sent over rest API to my machine.
i am not asking for converting JSON to a python object. it is an object coming from processing various classes and function.
the flask is just used to run the server on the background. Django can be used here so added in the tag.