jhyh786 发表于 2016-7-19 10:41:06

keystone验证报错怎么解决

大家好,我在做keystone验证时出现了点问题
已经添加admin租户和用户,使用admin租户和用户请求认证令牌可以查看到令牌信息。使用admin租户和用户的身份查看租户列表 keystone --os-tenant-name admin --os-username admin --os-password 123456 --os-auth-url http://controller.nice.com:35357/v2.0 tenant-list报错URL has an invalid label域名可以解析,也可以ping通。以admin租户和用户的身份查看用户列表也报同样的错误。



{:6_443:}




werwew 发表于 2016-7-26 09:40:40

http://stackoverflow.com/questions/16470064/python-requests-invalid-url-label-error
参考这个。
The error ('URL has an invalid label.') is probably a bug in requests library: it applies idna encoding (for internationalized domain names) on hostname with userinfo attached, source:

netloc = netloc.encode('idna').decode('utf-8')
that might raise 'label empty or too long' error for the long username:password. You can try to report it on the requests' issue tracker.

a:b@example.com form is deprecated otherwise requests.get('https://a:b@example.com') should be equivalent to requests.get('https://example.com', auth=('a', 'b')) if all characters in username:password are from [-A-Za-z0-9._~!$&'()*+,;=] set.

curl and requests also differ then there are percent-encoded characters in userinfo e.g., https://a:%C3%80@example.com leads to curl generating the following http header:

Authorization: Basic YTrDgA==
but requests produces:

Authorization: Basic YTolQzMlODA=
i.e.:

>>> import base64
>>> base64.b64decode('YTrDgA==')
'a:\xc3\x80'
>>> print _
a:À
>>> base64.b64decode('YTolQzMlODA=')
'a:%C3%80'
页: [1]
查看完整版本: keystone验证报错怎么解决