Commits

Flávio Coelho  committed a9704bd

implemented download de artigos

  • Participants
  • Parent commits 1cb7589

Comments (0)

Files changed (2)

File scholar/scholar/pipelines.py

 # See: http://doc.scrapy.org/topics/item-pipeline.html
 from time import time
 import urllib2
+from urllib2 import HTTPError
 
 class ScholarPipeline(object):
     def process_item(self, item, spider):
                 try:
                     with open(download_dir+timestamp+'.pdf','w') as p:
                         p.write(f.read())
-                except urllib2.HTTPError as error:
+                except HTTPError as error:
                     print "Download of file %s failed with %s"%(item['URL'],error)
             if html_url:
                 f = urllib2.urlopen(html_url,timeout=10)
                 try:
                     with open(download_dir+timestamp+'.html','w') as p:
                         p.write(f.read())
-                except urllib2.HTTPError as error:
+                except HTTPError as error:
                     print "Download of file %s failed with %s"%(item['URL'],error)
         return item

File scholar/scholar/pipelines.pyc

Binary file modified.