python: server is not receiving input from client flask

Chris Angelico rosuav at gmail.com
Tue Jun 29 14:03:27 EDT 2021


On Wed, Jun 30, 2021 at 3:38 AM Jerry Thefilmmaker
<jerrythefilmmaker at gmail.com> wrote:
> Thanks for taking the time to explained, Chris. Believe me, it helps. It had me thinking for a while. So, All the stuff about HTTP makes sense. I've been studying  and trying to wrap my head around the rest of your explanation and see how I can apply it to my codes.
>

Glad to hear it :)

> So, if I separate my GET method which would be to get the web page from my POST method which would be assigned to returning value from my form, wouldn't I have to dedicate 2 functions for any given requests in that sense?
>

The web page and form response are two completely separate requests.
You can't think of them as a single request; in fact, it's entirely
possible for someone to send the POST request without first getting
the page at all.

> The only reason I have parameters in my functions is so I can pass value from 1 function to another which is just stuff that happens in the background. Is it necessary to have them in my decorators as well, or is it that these values won't get passed around if they're not integrated in the decorators?
>

They won't get passed around. The only way to share that information
is via the page itself (or something along those lines, like a session
variable - which is some magic built on top of cookies). Think about
the two requests completely independently, and make sure that (a) the
GET request sends back the correct page, and (b) the POST request does
whatever it needs to, and sends back a new page.

Hopefully that should set you in the right direction!

ChrisA


More information about the Python-list mailing list