User-Agentを指定してURLの内容を取得
2系で確認
import urllib2 geturl = 'http://www.google.com' req = urllib2.Request(geturl, headers={'User-Agent' : "Some Browser"}) response = urllib2.urlopen(req) html = response.read()
2系で確認
import urllib2 geturl = 'http://www.google.com' req = urllib2.Request(geturl, headers={'User-Agent' : "Some Browser"}) response = urllib2.urlopen(req) html = response.read()