In my java code, I want to be able to call a URL and that URL should run my python script. Does anyone have a recommendation?
I have tried using Heroku to host the python script but I will also like an alternative
When I host my python code on my local server I can call the URL and the python script runs
But I want to be able to host the python script somewhere else so I can call the URL from my android app
-
Are you asking advices on python hosting services?BackSlash– BackSlash2019年07月02日 06:13:46 +00:00Commented Jul 2, 2019 at 6:13
1 Answer 1
You need some kind of server to receive the request I have an example of flask here. A server-side code to receive and use the POST request using flask would look like this:
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['POST'])
def result():
print(request.form['foo']) # should display 'bar'
return 'Received !' # response to your request.
This is the simplest & quickest way to send/receive a POST request using python.
You can also use java to send the POST request.