title: Python 3 - Add custom headers to urllib.request Request
body: <p>In <strong>Python 3</strong>, the following code obtains the HTML source for a webpage.</p>
  
  <pre><code>import urllib.request
  url = "https://docs.python.org/3.4/howto/urllib2.html"
  response = urllib.request.urlopen(url)
  
  response.read()
  </code></pre>
  
  <p>How can I add the following custom header to the request when using urllib.request?</p>
  
  <pre><code>headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' }
  </code></pre>