Skip to content

Instantly share code, notes, and snippets.

@akku1139
Last active December 17, 2023 06:39
Show Gist options
  • Select an option

  • Save akku1139/68d69945fc3ddf24741a1a8bf2e377c2 to your computer and use it in GitHub Desktop.

Select an option

Save akku1139/68d69945fc3ddf24741a1a8bf2e377c2 to your computer and use it in GitHub Desktop.
Replitのkeep-alive用
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
from threading import Thread
class CustomHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain; charset=utf-8')
self.end_headers()
self.wfile.write('GETメソッドを実装'.encode())
httpd = HTTPServer(('0.0.0.0', 8080), CustomHTTPRequestHandler)
t = Thread(target=httpd.serve_forever)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment