title: Open QRCode in Webbrowser with python
body: <p>I have an industrial barcode scanner.</p>
  
  <p>I want to scan a QRCode which contains a URI and it should open automatically that URI directly in the default browser of the machine.</p>
  
  <p>I have the following code:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  import pyHook
  import pythoncom
  import re
  import webbrowser
  
  
  
  endDomains = ".de|.com|.net|.org|.edu|.gov|.mil|.aero|.asia|.biz|.cat|.coop|.info|.int|.jobs|.mobi|.museum|.name|.post|.pro|.tel|.travel".split("|")
  chars = ""
  def pressed_chars(event):
      global chars
      if event.Ascii:
          char = chr(event.Ascii)    
          if event.Ascii == 3:
              quit()
          else:
              chars += char
              try:
                  urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&amp;+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', chars)
                  print(urls)
              except:
                  urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&amp;+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', chars)
                  print(urls)
              if len(urls) &gt; 0:
                  for url in urls:
                      for i in endDomains:
                          if i in url:
  
  
                              webbrowser.open_new_tab(url)
  
                              chars = ""
                              break
  
  
  
  proc = pyHook.HookManager()
  proc.KeyDown = pressed_chars
  proc.HookKeyboard()
  pythoncom.PumpMessages()
  </code></pre>
  
  <p>But it doesn't open my browser.
  Can anyone help me?</p>
  
  <p>Operating system is Windows 10 with Python 2.7 + Pyhook installed.</p>
  
  <p><a href="https://i.stack.imgur.com/mMr5q.png" rel="nofollow noreferrer">Python output</a></p>