So i found this thread:
Python replacement for PHP's header
but i still couldn't find my answer, i don't understand the first answer because i don't use Django and i want to use pure python (I'm using CGI)
the second answer also doesn't give details, i tried using start_response()
but i couldn't get it to redirect to my url, maybe i was giving it the wrong arguments
also i found another topic:
How to redirect a page to another page in python 3 cgi
but again the answer is still not as good as php header because it loads the entire page then redirects it which user can notice, the header function wasn't like this and was much faster and cleaner
i also tried webbrowser.open()
and webbrowser.get().open()
but the problem is they open a new tab instead of loading it right there, even when i use the new=0 option! (not to mention some weird problem that causes it to open IE as well as chrome which we have to give full path to fix)
so if the best option is start_response()
, can someone explain what exactly should i write?
what would be the equivalent of this php header:
header("location: ./index.php?msg=Invalid Username or Password");