Пример #1
0
    def wiki2pdf(self, url, font='Serif'):
        m = hashlib.md5()
        m.update(url.encode("utf-8"))
        filename =  m.hexdigest()[0:5]+".pdf"
        #if not os.path.exists(os.path.join(os.path.dirname(__file__), "tmp",filename)):
        parser = Wikiparser(url,filename, font) 
        parser.parse()
        #else:
		#	print ("File already exists.")    
        return ("modules/render/tmp/"+filename)
Пример #2
0
 def wiki2pdf(self, url, font='Serif'):
     m = hashlib.md5()
     m.update(url.encode("utf-8"))
     filename = m.hexdigest()[0:5] + ".pdf"
     #if not os.path.exists(os.path.join(os.path.dirname(__file__), "tmp",filename)):
     parser = Wikiparser(url, filename, font)
     parser.parse()
     #else:
     #	print ("File already exists.")
     return ("modules/render/tmp/" + filename)
Пример #3
0
 def wiki2pdf(self, url, path=None, font='Serif'):
     """
     :param url: the url for the wiki page
     :type url: str.
     :param font: the font to be used for the pdf.
     :type font: str.
     :param path: output path.Defaults to current dir
     :returns: the path to the generated pdf.
     """
     if path is None:
         path = self.output_path
     m = hashlib.md5()
     m.update(url.encode("utf-8"))
     filename = m.hexdigest()[0:5]+".pdf"
     filepath = os.path.join(path, filename)
     parser = Wikiparser(url, filepath, font)
     parser.parse()
     return filename
Пример #4
0
 def wiki2pdf(self, url, path=None, font='Serif'):
     """
     :param url: the url for the wiki page
     :type url: str.
     :param font: the font to be used for the pdf.
     :type font: str.
     :param path: output path.Defaults to current dir
     :returns: the path to the generated pdf.
     """
     if path is None:
         path = os.path.abspath(os.path.curdir)
     m = hashlib.md5()
     m.update(url.encode("utf-8"))
     filename = m.hexdigest()[0:5]+".pdf"
     filename = os.path.join(path, filename)
     print(filename)
     parser = Wikiparser(url, filename, font)
     parser.parse()
     #else:
     #	print ("File already exists.")
     return (os.path.join(self.tmp_folder, filename))
Пример #5
0
 def wiki2pdf(self, url):
     filename =  str(uuid.uuid1())[0:5] +".pdf"
     parser = Wikiparser(url,filename) #"http://ml.wikipedia.org/wiki/Computer"
     parser.parse()
     return ("modules/render/tmp/"+filename)
Пример #6
0
 def wiki2pdf(self, url):
     filename =  str(uuid.uuid1())[0:5] +".pdf"
     parser = Wikiparser(url,filename) #"http://ml.wikipedia.org/wiki/Computer"
     parser.parse()
     return ("modules/render/tmp/"+filename)