title: In Python why does urllib.urlopen make Google give an http status "302 Moved"?
body: <p>Using Python 2.6.6 on CentOS 6.4    </p>
  
  <pre><code>import urllib
  #url = 'http://www.google.com.hk'    #ok
  #url = 'http://clients1.google.com.hk'    #ok
  #url = 'http://clients1.google.com.hk/complete/search'  #ok (blank)
  url  = 'http://clients1.google.com.hk/complete/search?output=toolbar&amp;hl=zh-CN&amp;q=abc'  #fails
  print url
  page = urllib.urlopen(url).read()
  print page
  </code></pre>
  
  <p>Using the first 3 URLs, the code works.  But with the 4th URL, Python gives the following 302:</p>
  
  <pre><code>&lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;
  &lt;TITLE&gt;302 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;
  &lt;H1&gt;302 Moved&lt;/H1&gt;
  The document has moved
  &lt;A HREF="http://clients1.google.com.hk/complete/search?output=toolbar&amp;amp;hl=zh-CN&amp;amp;q=abc"&gt;here&lt;/A&gt;.
  &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>
  
  <p>The URL in my code is the same as the URL it tells me to use:</p>
  
  <pre><code>My URL:  http://clients1.google.com.hk/complete/search?output=toolbar&amp;hl=zh-CN&amp;q=abc
  Its URL: http://clients1.google.com.hk/complete/search?output=toolbar&amp;hl=zh-CN&amp;q=abc
  </code></pre>
  
  <p>Google says URL moved, but the URLs are the same. Any ideas why?</p>
  
  <p>Update: The URLs all work fine in a browser.  But in Python command line the 4th URL is giving a 302.</p>