Жиляев Алексей Андреевич 2 лет назад
Сommit
bf951b7a6f
8 измененных файлов с 91 добавлено и 0 удалено
  1. 9 0
      .idea/.gitignore
  2. 6 0
      .idea/inspectionProfiles/profiles_settings.xml
  3. 4 0
      .idea/misc.xml
  4. 8 0
      .idea/modules.xml
  5. 6 0
      .idea/vcs.xml
  6. 10 0
      .idea/ОАКС.iml
  7. 48 0
      MAIN.py
  8. BIN
      Отчет.docx

+ 9 - 0
.idea/.gitignore

@@ -0,0 +1,9 @@
+# Default ignored files
+/shelf/
+.idea/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 6 - 0
.idea/inspectionProfiles/profiles_settings.xml

@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>

+ 4 - 0
.idea/misc.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (ОАКС)" project-jdk-type="Python SDK" />
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/ОАКС.iml" filepath="$PROJECT_DIR$/.idea/ОАКС.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -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>

+ 10 - 0
.idea/ОАКС.iml

@@ -0,0 +1,10 @@
+<?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="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 48 - 0
MAIN.py

@@ -0,0 +1,48 @@
+from http.server import HTTPServer, BaseHTTPRequestHandler
+
+
+class HttpGetHandler(BaseHTTPRequestHandler):
+    def do_GET(self):
+        try:
+            if self.path.endswith("/OK"):
+                self.send_response(200)
+
+                self.send_header("Content-type", "text/html")
+                self.end_headers()
+
+                http_text = """ <html><head><meta charset= 'utf-8'>
+                <title>Простой HTTP-сервер.</title></head>
+                <body>Главная страница.</body></html>"""
+
+                self.wfile.write(http_text.encode())
+
+            if self.path.endswith("/info"):
+                self.send_response(200)
+
+                self.send_header("Content-type", "text/html")
+                self.end_headers()
+
+                http_text = """ <html><head><meta charset= 'utf-8'>
+                <title>Информация.</title></head></html>
+                <body>Жиляев А.А. 703гр.</body></html>"""
+
+                self.wfile.write(http_text.encode())
+
+        except IOError:
+            self.send_error(400, f"File not found{self.path}")
+
+
+def main(server_class=HTTPServer, handler_class=HttpGetHandler):
+    server_address = ('localhost', 8000)
+    httpd = server_class(server_address, handler_class)
+    try:
+        print("Запускаем сервер!")
+        httpd.serve_forever()
+
+    except KeyboardInterrupt:
+        httpd.server_close()
+        print("Сервер остановлен!")
+
+
+if __name__ == '__main__':
+    main()

BIN
Отчет.docx