Reputation: 125
I have this simple flask app with one endpoint and I am trying to receive data from a POST request in curl. This is my code:
from flask import Flask
from flask import request
def create_app():
app = Flask(__name__)
@app.route("/shipment", methods=["POST"])
def hello_world():
if "start" in request.args:
return "arg found"
else:
return "missing args"
return app
curl -X POST 127.0.0.1:5000/shipment -d start="test"
Upvotes: 0
Views: 187
Reputation: 479
request.args
can only retrieve key/value pair in the URL. You need to check request.values
instead.
Upvotes: 1