def post_inventory_html(self, section_dict, bucket, bucket_name):
manual_urls = '<h1>{}</h1>'.format("Manual PDFs")
for category in section_dict:
if URL_LIST_CATEGORIES == None or category in URL_LIST_CATEGORIES:
manual_urls += '<h2>{}</h2>'.format(category)
manual_urls += '<table>'
manual_urls += section_dict[category]
manual_urls += '</table>'
date = time.strftime('%l:%M%p %Z on %b %d, %Y')
manual_urls += '<h3 style="color:gray"><em>Last Updated: {}</em></h3>'.format(date)
with open(os.path.join(ZENDESK_UTIL_DIR, 'gen/url_list.html'), 'w') as url_file:
url_file.write(manual_urls)
with open(os.path.join(ZENDESK_UTIL_DIR, 'gen/url_list.html'), 'r') as url_file:
k = Key(bucket)
k.key = '/' + S3_DIRECTORY_FOR_MANUAL + '/url_list.html'
k.set_contents_from_file(url_file, cb=self.percent_cb, num_cb=1)
print("POSTED inventory html to S3 at: " + bucket_name + k.key)
评论列表
文章目录