yps.py
This commit is contained in:
parent
9a6b18a02c
commit
2b2ad8b76f
|
@ -2,6 +2,7 @@
|
|||
import socket
|
||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
import argparse
|
||||
import os
|
||||
|
||||
class MyHandler(SimpleHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
|
@ -18,9 +19,13 @@ class HTTPServerV6(HTTPServer):
|
|||
address_family = socket.AF_INET6
|
||||
|
||||
def main():
|
||||
suankiyer=os.getcwd()
|
||||
parser = argparse.ArgumentParser(description='yerel pratik sunucu')
|
||||
parser.add_argument('-p', '--port', help='calisma portu', type=int, default=9000)
|
||||
parser.add_argument('-d', '--directory', help='calisma dizini', type=str,default=suankiyer)
|
||||
args = parser.parse_args()
|
||||
print ("çalışma dizini: ",args.directory)
|
||||
os.chdir(args.directory)
|
||||
server = HTTPServerV6(('::', args.port), MyHandler)
|
||||
server.serve_forever()
|
||||
|
||||
|
|
Loading…
Reference in New Issue