Čau potřebuji vygenerovat token z adresy ale háže mi to chybu. Díky
import httplib
import json
url = "xxxxx"
osuser = "xxxx"
ospassword = "xxxx"
params = '{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"YourTenantIdGoesHere"}}'
headers = {"Content-Type": "application/json"}
conn = httplib.HTTPConnection(url)
conn.request("POST", "/v2.0/tokens", params, headers)
response = conn.getresponse()
data = response.read()
dd = json.loads(data)
conn.close()
apitoken = dd['access']['token']['id']
print "Your token is: %s" % apitoken
CHYBA:
Traceback (most recent call last):
File "C:\Users\David\Desktop\gentoken.py", line 20, in <module>
apitoken = dd['access']['token']['id']
KeyError: 'access'