title: Python - How to open urls (html files) which are located on an internal network with urlopen?
body: <p>The addresses I am trying to open look like this:<br>
  "//usa-qa/QAEngr/QA_Team_VSripathi/Negar/Help files/broken/header_test/main.htm" </p>
  
  <p>They are located on a company's internal network. </p>
  
  <p>I tried this piece of code:  </p>
  
  <pre><code> import urllib  
   import urllib.request as ur  
   address="//usa-qa/QAEngr/QA_Team_VSripathi/Negar/Help files/broken/header_test/main.htm"  
   info=ur.urlopen(address)
  </code></pre>
  
  <p>which results in the following error: </p>
  
  <pre><code>Traceback (most recent call last):  
    File "C:/Users/naref/Desktop/networktest.py", line 14, in &lt;module&gt;  
      info=ur.urlopen(address)  
    File "C:\Python33\lib\urllib\request.py", line 160, in urlopen  
      return opener.open(url, data, timeout)  
    File "C:\Python33\lib\urllib\request.py", line 458, in open  
      req = Request(fullurl, data)  
    File "C:\Python33\lib\urllib\request.py", line 279, in __init__  
      self._parse()  
    File "C:\Python33\lib\urllib\request.py", line 284, in _parse  
      raise ValueError("unknown url type: %s" % self.full_url)  
  ValueError: unknown url type: //usa-qa/QAEngr/QA_Team_VSripathi/Negar/Help files/broken/header_test/main.htm 
  </code></pre>
  
  <p>The same happens when converting the path to url:  </p>
  
  <pre><code>info=ur.urlopen(ur.pathname2url(address))
  </code></pre>
  
  <p>Then I tried to add an "http:" to the beginning of the address:  </p>
  
  <pre><code>address="http://usa-qa/QAEngr/QA_Team_VSripathi/Negar/Help files/broken/header_test/main.htm"  
  info=ur.urlopen(address)
  </code></pre>
  
  <p>Which results in the following error:  </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/naref/Desktop/networktest.py", line 14, in &lt;module&gt;  
      info=ur.urlopen(address)  
    File "C:\Python33\lib\urllib\request.py", line 160, in urlopen  
      return opener.open(url, data, timeout)  
    File "C:\Python33\lib\urllib\request.py", line 473, in open  
      response = self._open(req, data)  
    File "C:\Python33\lib\urllib\request.py", line 491, in _open  
      '_open', req)  
    File "C:\Python33\lib\urllib\request.py", line 451, in _call_chain  
      result = func(*args)  
    File "C:\Python33\lib\urllib\request.py", line 1272, in http_open  
      return self.do_open(http.client.HTTPConnection, req)  
    File "C:\Python33\lib\urllib\request.py", line 1255, in do_open  
      raise URLError(err)  
  urllib.error.URLError:&lt;urlopen error [WinError 10061] No connection could be made because the target machine actively refused it&gt;
  </code></pre>
  
  <p>It is interesting that this problem gets solved when I map the network drive on my computer which runs windows 8: (<a href="http://windows.microsoft.com/en-us/windows-8/create-shortcut-to-map-network-drive" rel="nofollow">http://windows.microsoft.com/en-us/windows-8/create-shortcut-to-map-network-drive</a>)</p>
  
  <p>Also the file can be opened with the open function instead of the urlopen, however I prefer to use urlopen since for my purpose the address might be a website's url.</p>