title: HTTP Error 403: Forbidden w/ User Agents Added
body: <p>Usually I've been able to get around 403 Errors once I've added a known User Agent but I'm now trying to login and then eventually scrape and cannot figure out how to bypass this error.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import urllib
  import http.cookiejar
  
  cj = http.cookiejar.CookieJar()
  opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
  opener.addheaders = [('User-agent', 'Mozilla/5.0')]
  urllib.request.install_opener(opener)
  authentication_url = 'https://www.linkedin.com/'
  payload = {
      'session_key': 'email',
      'session_password': 'password'
  }
  data = urllib.parse.urlencode(payload)
  binary_data = data.encode('UTF-8')
  req = urllib.request.Request(authentication_url, binary_data)
  resp = urllib.request.urlopen(req)
  contents = resp.read()
  </code></pre>
  
  <p><strong>Traceback</strong>:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "C:/Python34/loginLinked.py", line 16, in &lt;module&gt;
      resp = urllib.request.urlopen(req)
    File "C:\Python34\lib\urllib\request.py", line 161, in urlopen
      return opener.open(url, data, timeout)
    File "C:\Python34\lib\urllib\request.py", line 469, in open
      response = meth(req, response)
    File "C:\Python34\lib\urllib\request.py", line 579, in http_response
      'http', request, response, code, msg, hdrs)
    File "C:\Python34\lib\urllib\request.py", line 507, in error
      return self._call_chain(*args)
    File "C:\Python34\lib\urllib\request.py", line 441, in _call_chain
      result = func(*args)
    File "C:\Python34\lib\urllib\request.py", line 587, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 403: Forbidden
  </code></pre>