title: Cannot fetch url using neither urllib2 nor requests
body: <p>I'm trying to do this on remote Ubuntu Server:</p>
  
  <pre><code>&gt;&gt;&gt; import urllib2, requests
  &gt;&gt;&gt; url = 'http://python.org/'
  &gt;&gt;&gt; urllib2.urlopen(url)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
      return _opener.open(url, data, timeout)
    File "/usr/lib/python2.7/urllib2.py", line 406, in open
      response = meth(req, response)
    File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
      'http', request, response, code, msg, hdrs)
    File "/usr/lib/python2.7/urllib2.py", line 444, in error
      return self._call_chain(*args)
    File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
      result = func(*args)
    File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
      raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
  urllib2.HTTPError: HTTP Error 404: Not Found
  
  &gt;&gt;&gt; requests.get(url)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/home/django/zyq2/venv/local/lib/python2.7/site-packages/requests/api.py", line 55, in get
      return request('get', url, **kwargs)
    File "/home/django/zyq2/venv/local/lib/python2.7/site-packages/requests/api.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
    File "/home/django/zyq2/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 382, in request
      resp = self.send(prep, **send_kwargs)
    File "/home/django/zyq2/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 505, in send
      history = [resp for resp in gen] if allow_redirects else []
    File "/home/django/zyq2/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 99, in resolve_redir  ts
      raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects)
  requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
  </code></pre>
  
  <p>But it works fine on local Windows machine:</p>
  
  <pre><code>&gt;&gt;&gt; urllib2.urlopen(url)
  &lt;addinfourl at 57470168 whose fp = &lt;socket._fileobject object at 0x036CB630&gt;&gt;
  &gt;&gt;&gt; requests.get(url)
  &lt;Response [200]&gt;
  </code></pre>
  
  <p>I have absolutely no idea about what's going on and would appreciate any suggestion.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I tried S.M. Al Mamun's suggestion and got an exception with long traceback:</p>
  
  <pre><code>&gt;&gt;&gt; req = urllib2.Request(url, headers={ 'User-Agent': 'Mozilla/5.0' })
  &gt;&gt;&gt; urllib2.urlopen(req).read()
  ...
  long traceback (more than one page)
  ...
  urllib2.HTTPError: HTTP Error 303: The HTTP server returned a redirect error that would lead to an infinite loop.
  The last 30x error message was:
  See Other
  </code></pre>
  
  <p>Infinite loop again (I mean TooManyRedirects exception).</p>