Browse Source

Merge

master
khaloufam70043 4 years ago
parent
commit
aa1c1d7331
6 changed files with 69 additions and 16 deletions
  1. 13
    0
      .idea/Python.iml
  2. 7
    0
      .idea/misc.xml
  3. 8
    0
      .idea/modules.xml
  4. 6
    0
      .idea/vcs.xml
  5. 19
    16
      HTTP und HTML/Quadratzahlen.py
  6. 16
    0
      Socket/ohm.server.py

+ 13
- 0
.idea/Python.iml View File

@@ -0,0 +1,13 @@
<?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>

+ 7
- 0
.idea/misc.xml View File

@@ -0,0 +1,7 @@
<?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>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
<?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>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

+ 19
- 16
HTTP und HTML/Quadratzahlen.py View File

@@ -7,6 +7,12 @@ class EigenerHandler(http.server.BaseHTTPRequestHandler):
self.send_response(200)
self.send_header('Content-type', 'text-html')
self.end_headers()

von = 3
bis = 10



msg = """
<html>
<head>
@@ -16,25 +22,22 @@ class EigenerHandler(http.server.BaseHTTPRequestHandler):
}
</style>
</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>
"""

self.wfile.write(msg.encode())

port = 12345

+ 16
- 0
Socket/ohm.server.py View File

@@ -0,0 +1,16 @@
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()

Loading…
Cancel
Save