示例#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])
示例#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])
示例#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)
示例#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)