Skip to content

Instantly share code, notes, and snippets.

Avatar

Ron Dias TheRedMudder

View GitHub Profile
@TheRedMudder
TheRedMudder / HTTPPostHandler.py
Created Jan 28, 2018
Handle HTTP Post W/O additional Modules
View HTTPPostHandler.py
from http.server import SimpleHTTPRequestHandler
from socketserver import TCPServer
from urllib.parse import parse_qsl
from threading import Thread
#Choose how you want to Process the post data in this function
def processPostData(post=["No Post Data"]):#Print all post data
for field in post:
print(field)
class PostHandler(SimpleHTTPRequestHandler):
def do_POST(self):
View fixhost.py
import os,errno,shutil,glob,htmlmin,codecs;
# Delete in Background
def trmSilentDelete(filename):
try:
os.remove(filename)
except OSError as e:
if e.errno != errno.ENOENT: #No Raise Exception if no such file or directory
raise # Raise Exception other Error
# Replace Content in File With
You can’t perform that action at this time.