How do I open a webpage? and have python communicate with that page?
Me and a friend( @TheC0derGirl ) are making a "simple" python game where you choose what to make: a pizza, icecream, and hot coco. And were going to open a page when its finished to show the finished product and we need to communacate those two projects to tell the website what the pizza or icecrem, etc. looks like so it knows what to put on the page.
MEGATANK58 (0)
You can pass arguments as text (or http requests) or URL arguments to the website and receive it on the other end and show the image
JULIODIAZ1 (46)
im confused
@MEGATANK58
TheC0derGirl (210)
Yep yep yep
You can send a link like this
https://repl.username.repl.co/?food=pizza
and have a flask server at that address like
You can have more URL arguments on the end like
https://repl.username.repl.co/?food=pizza&topping1=cheese
Then have more
elifs
to renderpizzawithcheese.html
And get the URL arguments with
request.args.get
Sorry if that doesn't make as much sense as it could I'm on mobile and it's hard to type
@19ecal oooooooooooooooooooooooooooooh ok thanks
thanks! ill try and make sense of it!
@19ecal
@JULIODIAZ1 @TheC0derGirl I forgot, that won't work, you need to run it with
app.run(host="0.0.0.0")
at the endokey!
@19ecal
question, would it be possible to send variables over from python to the html page? @19ecal
@JULIODIAZ1 Well, you can use this
Python:
page.html
That should put whatever you put
text
as inrender_template()
in the<p>
:O thanks @19ecal
@19ecal oooooooo ok Thank you!