Hi,
Totally new to Python and programming in general.
I tried to integrate Python SDK from Commvault to the browser using Flask.
But couldn’t make it work. Could you point me what should I modify?
From python code, when I execute the python command:
>>> print(commcell.clients)
It will return:
S. No. Client 1 mylocalcmv 2 mylocalcmv_livesync 3 mylocalcmv1_livesync_node 4 mylocalcmv2
Here’s my attempt to return the value in browser:
app.py:
from cvpysdk.commcell import Commcell from flask import Flask, Response # Initialize the Flask app app = Flask(__name__) # Login to Commcell commcell = Commcell('mylocalcmv.test.com', 'mylocaluser', 'mylocalpwd') @app.route('/') def show_clients(): # Fetch clients from the SDK clients_output = commcell.clients # Execute the SDK command return render_template_string(f""" <html> <head><title>Commcell Clients</title></head> <body> <h1>Commcell Clients</h1> <p>{clients_output.replace('n', '<br>')}</p> </body> </html> """) if __name__ == '__main__': app.run(debug=True)
Browser returned:
Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Thanks
submitted by /u/ivonivon
[link] [comments]
r/learnpython Hi, Totally new to Python and programming in general. I tried to integrate Python SDK from Commvault to the browser using Flask. But couldn’t make it work. Could you point me what should I modify? From python code, when I execute the python command: >>> print(commcell.clients) It will return: S. No. Client 1 mylocalcmv 2 mylocalcmv_livesync 3 mylocalcmv1_livesync_node 4 mylocalcmv2 Here’s my attempt to return the value in browser: app.py: from cvpysdk.commcell import Commcell from flask import Flask, Response # Initialize the Flask app app = Flask(__name__) # Login to Commcell commcell = Commcell(‘mylocalcmv.test.com’, ‘mylocaluser’, ‘mylocalpwd’) @app.route(‘/’) def show_clients(): # Fetch clients from the SDK clients_output = commcell.clients # Execute the SDK command return render_template_string(f””” <html> <head><title>Commcell Clients</title></head> <body> <h1>Commcell Clients</h1> <p>{clients_output.replace(‘n’, ‘<br>’)}</p> </body> </html> “””) if __name__ == ‘__main__’: app.run(debug=True) Browser returned: Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. Thanks submitted by /u/ivonivon [link] [comments]
Hi,
Totally new to Python and programming in general.
I tried to integrate Python SDK from Commvault to the browser using Flask.
But couldn’t make it work. Could you point me what should I modify?
From python code, when I execute the python command:
>>> print(commcell.clients)
It will return:
S. No. Client 1 mylocalcmv 2 mylocalcmv_livesync 3 mylocalcmv1_livesync_node 4 mylocalcmv2
Here’s my attempt to return the value in browser:
app.py:
from cvpysdk.commcell import Commcell from flask import Flask, Response # Initialize the Flask app app = Flask(__name__) # Login to Commcell commcell = Commcell('mylocalcmv.test.com', 'mylocaluser', 'mylocalpwd') @app.route('/') def show_clients(): # Fetch clients from the SDK clients_output = commcell.clients # Execute the SDK command return render_template_string(f""" <html> <head><title>Commcell Clients</title></head> <body> <h1>Commcell Clients</h1> <p>{clients_output.replace('n', '<br>')}</p> </body> </html> """) if __name__ == '__main__': app.run(debug=True)
Browser returned:
Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Thanks
submitted by /u/ivonivon
[link] [comments]