This is output of my following test program, so this issue can be indirectly resolved by using v3/auth/tokens?nocatalog to instead of v3/auth/tokens as Dolph said, pls mark it as "Won't Fix", thanks.
TOKEN_LEN: 1196 when using http://pubnode:5000/v3/auth/tokens?nocatalog TOKEN_LEN: 10220 when using http://pubnode:5000/v3/auth/tokens
import urllib2 import json
user = 'admin' password = 'password' project = 'demo'
def token_v3(auth_url = 'http://pubnode:5000/v3/auth/tokens?nocatalog'): auth_request = urllib2.Request(auth_url) auth_request.add_header('Content-Type', 'application/json;charset-utf8') auth_request.add_header('Accept', 'application/json') auth_request.add_header('User-Agent', 'python-client') auth_data = { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": user, "password": password, "domain": { "name": "default" } } } }, "scope": { "project": { "domain": { "name": "default" }, "name": project } } } } auth_request.add_data(json.dumps(auth_data)) auth_response = urllib2.urlopen(auth_request) token = auth_response.info().getheader('X-Subject-Token') return token
if __name__ == '__main__': url = 'http://pubnode:5000/v3/auth/tokens?nocatalog' token = token_v3(url) print "TOKEN_LEN: ", len(token), " when using ", url url = 'http://pubnode:5000/v3/auth/tokens' token = token_v3(url) print "TOKEN_LEN: ", len(token), " when using ", url
This is output of my following test program, so this issue can be indirectly resolved by using v3/auth/ tokens? nocatalog to instead of v3/auth/tokens as Dolph said, pls mark it as "Won't Fix", thanks.
TOKEN_LEN: 1196 when using http:// pubnode: 5000/v3/ auth/tokens? nocatalog pubnode: 5000/v3/ auth/tokens
TOKEN_LEN: 10220 when using http://
import urllib2
import json
user = 'admin'
password = 'password'
project = 'demo'
def token_v3(auth_url = 'http:// pubnode: 5000/v3/ auth/tokens? nocatalog'): Request( auth_url) request. add_header( 'Content- Type', 'application/ json;charset- utf8') request. add_header( 'Accept' , 'application/json') request. add_header( 'User-Agent' , 'python-client')
"methods" : [
"password"
"password" : {
"user" : {
" name": user,
" password" : password,
" domain" : {
"name" : "default"
}
"project" : {
"domain" : {
" name": "default"
"name" : project request. add_data( json.dumps( auth_data) ) urlopen( auth_request) info(). getheader( 'X-Subject- Token')
auth_request = urllib2.
auth_
auth_
auth_
auth_data = {
"auth": {
"identity": {
],
}
}
},
"scope": {
},
}
}
}
}
auth_
auth_response = urllib2.
token = auth_response.
return token
if __name__ == '__main__': pubnode: 5000/v3/ auth/tokens? nocatalog' pubnode: 5000/v3/ auth/tokens'
url = 'http://
token = token_v3(url)
print "TOKEN_LEN: ", len(token), " when using ", url
url = 'http://
token = token_v3(url)
print "TOKEN_LEN: ", len(token), " when using ", url