scripts/scraper.py
def save_article_html(self, article):
        """Makes the HTML for the article and saves it to a file.
        article is all the article's data from the API.
        Returns the filename.
        """
        html = self.make_article_html(article)

        # There was once an article ID that was 300 characters long, and the maximum
        # filename length is 255. So we gave up on saving the files with nice readable
        # names and instead make a hash of the ID and use that.
        filename_hash = hashlib.md5(article["id"].encode('utf-8')).hexdigest()
        filename = "%s.%s" % (filename_hash, "html")

        try:
            article_file = open(self.issue_archive_dir + filename, "w")
            try:
                article_file.write(html)
            finally:
                article_file.close()
        except IOError:
            raise ScraperError(
                "IOError when writing " + self.issue_archive_dir + filename
            )

        return filename
Makes the HTML for the article and saves it to a file.
        article is all the article's data from the API.
        Returns the filename.
        
Makes the HTML for the article and saves it to a file.
article is all the article's data from the API.
Returns the filename.
Makes the HTML for the article and saves it to a file . article is all the article ' s data from the API . Returns the filename .
def save_article_html(self, article):
        html = self.make_article_html(article)
        filename_hash = hashlib.md5(article["id"].encode('utf-8')).hexdigest()
        filename = "%s.%s" % (filename_hash, "html")
        try:
            article_file = open(self.issue_archive_dir + filename, "w")
            try:
                article_file.write(html)
            finally:
                article_file.close()
        except IOError:
            raise ScraperError(
                "IOError when writing " + self.issue_archive_dir + filename
            )
        return filename
def save_article_html ( self , article ) : html = self . make_article_html ( article ) filename_hash = hashlib . md5 ( article [ "id" ] . encode ( 'utf-8' ) ) . hexdigest ( ) filename = "%s.%s" % ( filename_hash , "html" ) try : article_file = open ( self . issue_archive_dir + filename , "w" ) try : article_file . write ( html ) finally : article_file . close ( ) except IOError : raise ScraperError ( "IOError when writing " + self . issue_archive_dir + filename ) return filename
Makes the HTML for the article and saves it to a file.
Makes the HTML for the article and saves it to a file .
"""Makes the HTML for the article and saves it to a file.
        article is all the article's data from the API.
        Returns the filename.
        """ # There was once an article ID that was 300 characters long, and the maximum # filename length is 255. So we gave up on saving the files with nice readable # names and instead make a hash of the ID and use that.
self
article