Created
July 7, 2020 16:16
-
-
Save NimishMishra/5c30a34f7f4bc0cddc87487b470e06cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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