Example #1
0
def pretty_url(line):
    for scheme, host, path, query in RE_URL.findall(line):
        scheme = scheme or "http://"
        host = host.decode("idna")
        path = decode(urllib.unquote(path)) or ""
        query = decode(urllib.unquote(query)) or ""
        return u"".join([scheme, host, path, query])
Example #2
0
def pretty_url(line):
    for scheme, host, path, query in RE_URL.findall(line):
        scheme = scheme or 'http://'
        host = host.decode('idna')
        path = decode(urllib.unquote(path)) or ''
        query = decode(urllib.unquote(query)) or ''
        return u''.join([scheme, host, path, query])
Example #3
0
def sit(item, name):
    try:
        htmlstring = urllib.urlopen('http://www.sit.no/content.ap?thisId=%s' %
                                    item).read()
        root = fromstring(decode(htmlstring))
    except IOError, e:
        return '%s: %s' % (name, e)
Example #4
0
def sit(item, name):
    try:
        htmlstring = urllib.urlopen('http://www.sit.no/content.ap?thisId=%s' % item).read()
        root = fromstring(decode(htmlstring))
    except IOError, e:
        return '%s: %s' % (name, e)