本文来源吾爱破解论坛
本帖最后由 wushaominkk 于 2019-9-3 09:47 编辑 4.png (298.67 KB, 下载次数: 0)
下载附件
保存到相册
5.png (300.3 KB, 下载次数: 0)
下载附件
保存到相册
#by、晓东
[Python] 纯文本查看 复制代码
import sys from subprocess import Popen if sys.version_info[0] < 3: # python 2 import BaseHTTPServer else: # python 3 import http.server as BaseHTTPServer PORT = 7531 if sys.version_info[0] < 3: class CompatibilityMixin: def send_body(self, msg): self.wfile.write(msg+'\n') self.wfile.close() else: class CompatibilityMixin: def send_body(self, msg): self.wfile.write(bytes(msg+'\n', 'utf-8')) class Handler(BaseHTTPServer.BaseHTTPRequestHandler, CompatibilityMixin): def respond(self, code, body=None): self.send_response(code) self.send_header("Content-type", "text/plain") self.end_headers() if body: self.send_body(body) def do_GET(self): url = self.path.split("?",1)[1].split("=",1) print(url) if url[0] == "annie_url": url = url[1] pipe = Popen(['annie','-aria2',url]) def start(): httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) print("serving at port {}".format(PORT)) try: httpd.serve_forever() except KeyboardInterrupt: print(" shutting down...") httpd.shutdown() if __name__ == '__main__': start()
下载积分: 吾爱币 -1 CB
版权声明:
本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。