My request is : I have my web pages created in python (wherein there is html code), each pages has a button to go to the next page.
Is it possible to get the address of the client when we submit an html form for example ?
I mean, to have into the URL address of the client.
If that possible, I'll show my code, else I delete my question.
that's my html code :
ip = cgi.escape(os.environ["REMOTE_ADDR"])
<html>
path install: ${install_path}<br/><br/>
os: ${os}<br/><br/>
unix user: ${user_name}<br/><br/>
<form name="sd" method="get" action="ip/cgi/scriptGet.py">
Name: <input type="text" name="name"><br/><br/>
Pseudo: <input type="text" name="pseudo"/><br/><br/>
<input type="submit" value="OK"/>
</form>
and here my python code:
import os, sys, platform, getpass, tempfile
import webbrowser
import string
import json
import cgi, cgitb, os
def main( server_IP,install_path):
template = open('scriptHmtl.phtml').read()
contenu = string.Template(template).substitute(
install_path = install_path,
os = user_os,
user_name = user_login
)
if __name__ == "__main__":
server_IP = sys.argv[1]
install_path = sys.argv[2]
main(server_IP,install_path)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…