def read_webpage( url ):
    try:
        r = urllib.request.urlopen( url )
    except Exception as e:
        print('oops -', e)
        r = urllib.request.urlopen( url, context=ssl._create_unverified_context() )
    contentsb = r.read()
    encodings = [ 'utf-8', 'latin-1', 'ascii', 'EBCDIC', 'utf-16' ]
    for e in encodings:
        try:
            contents = contentsb.decode( e )
        except Exception as ex:
            print(ex, 'contents not', e)
        else:
            print(e, 'succeeded')
            break
    return contents