-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpserver.py
More file actions
19 lines (18 loc) · 787 Bytes
/
Copy pathhttpserver.py
File metadata and controls
19 lines (18 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
# -*- coding: latin-1 -*-
import SimpleHTTPServer # importe un ensemble d'instructions pour servir les requêtes http.
import SocketServer # importe un ensemble d'instructions pour connecter le programme.
# Ces deux ensembles sont disponibles à l'installation de Python
## Python 3 :
# import http.server
# import socketserver
# Serveur http de base delivrant le contenu du repertoire courant via le port indique.
PORT = 5432
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
## Python 3 :
# Handler = http.server.SimpleHTTPRequestHandler
# httpd = socketserver.TCPServer(("",PORT), Handler)
# print("à l'écoute sur le port :", PORT)
httpd.serve_forever()