Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def content(url, force=False):
if force or not os.path.exists(files.get_content_path(url)):
try:
response = requests.get(url, timeout=10)
c = "this is an archive. [go to %s](%s)\n\n" % (url,url)
c = "%s---\n\n" % c
if response.ok:
c = "%s### %s\n" % (c, Document(response.content).short_title())
c = "%s%s" % (c, html2text.html2text(Document(response.content).summary()))
else:
c = "%sFor one reason or another, this document couldn't be archived." % c
files.save_content(c, url)
except:
print "Failed to make markdown from: ", url