<?xml version="1.0" encoding="UTF-8"?> | |||||
<module type="PYTHON_MODULE" version="4"> | |||||
<component name="NewModuleRootManager"> | |||||
<content url="file://$MODULE_DIR$"> | |||||
<excludeFolder url="file://$MODULE_DIR$/venv" /> | |||||
</content> | |||||
<orderEntry type="jdk" jdkName="Python 3.7 (Python)" jdkType="Python SDK" /> | |||||
<orderEntry type="sourceFolder" forTests="false" /> | |||||
</component> | |||||
<component name="TestRunnerService"> | |||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |||||
</component> | |||||
</module> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="JavaScriptSettings"> | |||||
<option name="languageLevel" value="ES6" /> | |||||
</component> | |||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (Python)" project-jdk-type="Python SDK" /> | |||||
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectModuleManager"> | |||||
<modules> | |||||
<module fileurl="file://$PROJECT_DIR$/.idea/Python.iml" filepath="$PROJECT_DIR$/.idea/Python.iml" /> | |||||
</modules> | |||||
</component> | |||||
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="VcsDirectoryMappings"> | |||||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> | |||||
</component> | |||||
</project> |
self.send_response(200) | self.send_response(200) | ||||
self.send_header('Content-type', 'text-html') | self.send_header('Content-type', 'text-html') | ||||
self.end_headers() | self.end_headers() | ||||
von = 3 | |||||
bis = 10 | |||||
msg = """ | msg = """ | ||||
<html> | <html> | ||||
<head> | <head> | ||||
} | } | ||||
</style> | </style> | ||||
</head> | </head> | ||||
<body> | |||||
<h2>Quadratzahlen</h2> | |||||
<body> | |||||
<h2>Quadratzahlen</h2> | |||||
<form action="http://localhost:12345/" method="get"> | |||||
<div> | |||||
<label for="von">Von</label> | |||||
<input name="von" id="von" value="1"> | |||||
</div> | |||||
<div> | |||||
<label for="bis">Bis</label> | |||||
<input name="bis" id="bis" value="5"> | |||||
</div> | |||||
<div> | |||||
<button onclick="myFunction()">Eingeben</button> | |||||
</div> | |||||
</form> | |||||
</body> | |||||
<table style="width:100%"> | |||||
""" | |||||
while von <= bis: | |||||
msg = msg + "<tr><td>{}</td><td>{}</td></tr>".format(von, von*von) | |||||
von = von + 1 | |||||
msg = msg + """ | |||||
</table> | |||||
</body> | |||||
</html> | </html> | ||||
""" | """ | ||||
self.wfile.write(msg.encode()) | self.wfile.write(msg.encode()) | ||||
port = 12345 | port = 12345 |
import socket | |||||
s = socket.socket() # instantiate | |||||
hostname = "my.ohm-hochschule.de" | |||||
path = "content/index.jspx" | |||||
host = socket.gethostbyname(hostname) # as both code is running on same pc | |||||
port = 80 | |||||
CRLF = "\r\n" | |||||
s.connect((host,port)) | |||||
msg = ( "GET /{} HTTP /1.1{}".format(path, CRLF) + "Host: {}{}".format(hostname, CRLF) + CRLF) | |||||
print(msg) | |||||
s.send(msg.encode()) | |||||
bytes = s.recv(4096) | |||||
print(bytes.decode()) | |||||
s.close() |