Skip to content

Instantly share code, notes, and snippets.

@zh012
Created March 18, 2017 14:50
Show Gist options
  • Select an option

  • Save zh012/ea1d8a6cfaadc3ff898ce34b70043801 to your computer and use it in GitHub Desktop.

Select an option

Save zh012/ea1d8a6cfaadc3ff898ce34b70043801 to your computer and use it in GitHub Desktop.
ironpython launch browser
import System
import Microsoft
import Microsoft.Win32.Registry as Registry
from System.Threading import Thread, ThreadStart
def get_default_browser():
try:
key = Registry.ClassesRoot.OpenSubKey("HTTP\shell\open\command", False)
browser = key.GetValue(None).ToString().ToLower()
if browser.startswith('"'):
browser = browser.split('"')[1]
else:
browser = browser.split()[0]
browser = browser.strip()
return browser
finally:
if key:
key.Close()
def launch_default_browser(destination):
p = System.Diagnostics.Process()
p.StartInfo.FileName = get_default_browser()
p.StartInfo.Arguments = "%s" % destination
p.Start()
return p
import bottle
@bottle.route('/')
def home():
return "Extract the WeChat Info"
def runHttpServer():
bottle.run(host='localhost', port=9876)
def startServer():
thread = Thread(ThreadStart(runHttpServer))
thread.Start()
return thread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment