diff --git a/opengraph/opengraph.py b/opengraph/opengraph.py index 9cedb97..50e8834 100644 --- a/opengraph/opengraph.py +++ b/opengraph/opengraph.py @@ -47,7 +47,8 @@ def __getattr__(self, name): def fetch(self, url): """ """ - raw = urllib2.urlopen(url) + req = urllib2.Request(url, headers={'User-Agent' : "Mozilla"}) + raw = urllib2.urlopen(req, timeout=15) html = raw.read() return self.parser(html) @@ -123,4 +124,4 @@ def scrape_url(self, doc): def scrape_description(self, doc): tag = doc.html.head.findAll('meta', attrs={"name":"description"}) result = "".join([t['content'] for t in tag]) - return result \ No newline at end of file + return result