Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (26 sloc) 0.733 kb
import urllib
import json
import os
from bs4 import BeautifulSoup
def fetch(url):
_, filename = os.path.split(url)
path = os.path.join("cache", filename)
if not os.path.exists(path):
urllib.urlretrieve(url, path)
return filename, path
LICENSES = []
for line in open("licenses/all.txt"):
url, name = line.strip().split(" ", 1)
title, filename = fetch("http://www.opensource.org" + url.replace("\"", ""))
try:
soup = BeautifulSoup(open(filename))
except:
continue
pre = soup.find("pre")
if pre:
LICENSES.append({
'name': title,
'description': name,
'txt': pre.text,
})
print json.dumps(LICENSES, indent=4)
Jump to Line
Something went wrong with that request. Please try again.