-
-
Save burris/78a6eb1f3cf34301835e650185bc142b 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
#!/usr/bin/env python3 | |
import http.server | |
import socketserver | |
from http import HTTPStatus | |
PORT = 8000 | |
class Handler(http.server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(HTTPStatus.FOUND) | |
self.send_header("Location", "magnet:?xt=urn:btih:aa9dc8a79ddaba135a59966ecef849884a336f82&dn=hello.txt") | |
self.end_headers() | |
with socketserver.TCPServer(("", PORT), Handler) as httpd: | |
print("serving at port", PORT) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment