On 7 , 11:54, [EMAIL PROTECTED] wrote:
Hi,
I'm trying to get wikipedia page source with urllib2:
usock = urllib2.urlopen(http://en.wikipedia.org/wiki/
Albert_Einstein)
data = usock.read();
usock.close();
return data
I got exception because HTTP 403 error. why? with my
[EMAIL PROTECTED] wrote:
This source works fine for other site. the problem is in wikipedia. is
someone now any solution for this problem?
Wikipedia, AFAIK, bans requests without a User Agent.
http://www.voidspace.org.uk/python/articles/urllib2.shtml#headers
--
Lawrence, oluyede.org -
In articleâ [EMAIL PROTECTED],â¬
â [EMAIL PROTECTED] wroteâ:â¬
â â¬Hiâ,â¬
â â¬I'm trying to get wikipedia page source with urllib2â:â¬
â â¬usockâ =
â¬urllib2â.â¬urlopenâ(â¬httpâ://â¬en.wikipedia.org/wikiâ/â¬
â â¬Albert_Einsteinâ)â¬
â