2 Utilities to help handle urls
5 def normalize_url(url, scheme='http'):
7 Make sure there is a http at the head of what should be a url
9 >>> normalize_url("google.com")
11 >>> normalize_url("http://google.com")
13 >>> normalize_url("foo.com/a/b/c/d/e/f.html")
14 'http://foo.com/a/b/c/d/e/f.html'
15 >>> normalize_url("foo.com", "https")
19 if url.find(scheme_sep) != -1:
22 return scheme + scheme_sep + url