def folder(url, dirname): location = url + dirname msg = (htmlconv.h3(('>-- ' + dirname))) try: f = urllib.request.urlopen(location).getcode() except urllib.error.HTTPError as err: return (msg + htmlconv.perror(dirname + ' ' + str(err))) return (msg + htmlconv.p('found at ' + location))
def file(url, filename): location = (url + filename) msg = (htmlconv.h3('>-- ' + filename + ' File')) try: f = urllib.request.urlopen(location).getcode() except urllib.error.HTTPError as err: return (msg + htmlconv.perror(filename + ' ' + str(err))) return (msg + htmlconv.p('found at ' + url))
def seed25(self): self.text += (htmlconv.h1('Report 40%') + '\n') self.text += (htmlconv.h2('Wireframes 10%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('Report 30%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h1('Website 60%') + '\n') self.text += (htmlconv.h2('Usability et. al. 15%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('Design Aesthetic 10%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('Responsive Design 15%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('Professional Chrome 10%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('HTML Validation 5%') + '\n') self.text += (htmlconv.p('********') + '\n') self.text += (htmlconv.h2('CSS Validation 5%') + '\n') self.text += (htmlconv.p('********') + '\n')
output.append(htmlconv.style()) output.seed25() output.append(htmlconv.h1('Site Folder Structure')) output.append(sitestructure.folder(url, 'style')) output.append(sitestructure.folder(url, 'js')) output.append(sitestructure.folder(url, 'stylesheet')) output.append(sitestructure.folder(url, 'img')) output.append(sitestructure.folder(url, 'font')) output.append(sitestructure.folder(url, 'audio')) output.append(sitestructure.folder(url, 'video')) output.append(htmlconv.h1('Specific Site Files')) output.append(htmlconv.p(sitestructure.file(url, 'index.html'))) output.append(htmlconv.p(sitestructure.file(url, 'favicon.ico'))) while len(urls) > 0: try: htmltext = urlopen(urls[0]).read() except urllib.error.HTTPError as err: output.append(htmlconv.h1error('Link Scan Error: ')) output.append(htmlconv.p(urls[0] + ' ' + str(err))) urls.pop(0) continue except: output.append(htmlconv.h1('Unknown Program Error')) continue