Flask curl -d dont print in the console on windows


I’m starting learn Flask and i testing the http request for the console, and when i try to print a form.request on flask using the curl -d and print it on the code, the console is not printing the form request

enter image description here

(here is where is expected to print this and is not printing it

enter image description here

and heres the code

enter image description here

Like the code print it just 1 time, but when i execute the lele() again is not printing anymore

enter image description here

just when i add that line, no when i call lele()

Idk if is a windows thing, because i do this on Mac and it works, so idk


from flask import Flask,request

def lele():
    """ You can test this in postman by selecting `form-data` in the
    `Body` and giving the `name` as key and value michael (let's say)."""
    return str(user) # this is a POST request
    # return "lele"  # this is a GET request

if __name__=="__main__":
  • request.form: It is the dictionary object which contains the key-value pair of form parameters and their values.

when you run curl the function should return lele and that is what is being returned. If you want to see lele as an output,then it is a GET request. If you want to see michael as an output,then it is a POST request.

Answered By – Alankrith G

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published