title: python - request url as mobile
body: <p>I'm trying to send <code>GET</code> request to some urls with <code>User-Agent</code> as mobile to get the the redirected url (for example - <a href="http://m.google.com" rel="nofollow noreferrer">http://m.google.com</a> instead of <a href="http://google.com" rel="nofollow noreferrer">http://google.com</a>).</p>
  
  <p>I've tried <code>requests</code> library and <code>urllib2</code> too - it seems that the <code>User-Agent</code> isn't sent with the request. Also read another questions here but the answers was not clear enough - if its just buggy or I miss something?</p>
  
  <p>This is my code:</p>
  
  <pre><code>try:
      req = requests.get(item.url, headers={'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1'}, timeout=5)
  
  except requests.exceptions.HTTPError:
      continue
  
  except requests.exceptions.Timeout:
      continue
  
  print (item.url + ' =&gt; ' + req.url + ' (' + str(req.status_code) + ')')
  </code></pre>
  
  <p>Still, always get the computer version instead of mobile version.</p>