Skip to content

Instantly share code, notes, and snippets.

@NimishMishra
Created July 7, 2020 16:16
Show Gist options
  • Save NimishMishra/5c30a34f7f4bc0cddc87487b470e06cd to your computer and use it in GitHub Desktop.
Save NimishMishra/5c30a34f7f4bc0cddc87487b470e06cd to your computer and use it in GitHub Desktop.
def do_POST(self):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
data = post_data.decode('utf-8')
try:
data_split = data.split("SPLIT")
file_object = open("../responses" + str(time.time()) +".txt", "a")
for line in data_split:
file_object.write(line + "\n")
file_object.close()
except:
pass
self._set_response()
self.wfile.write(('POST OK').encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment