sandy@Swift_PC:~$ curl -D- -H 'X-Storage-User:Lucy'
sandy@Swift_PC:~$ curl -D- -H 'X-Storage-User:Lucy' http://192.168.119.89:8080/auth/v1.0
HTTP/1.1 200 OK
X-Storage-Url: http://192.168.119.89:8080/v1/AUTH_Lucy
X-Auth-Token: AUTH_tk713d067336d24348bcea1ab220965785
Content-Type: text/html; charset=UTF-8
X-Storage-Token: AUTH_tk713d067336d24348bcea1ab220965785
X-Trans-Id: tx8a03bc278f6d4ab899a25-00557554df
Content-Length: 0
Date: Mon, 08 Jun 2015 08:39:59 GMT
I can get the X-Storage-token with curl.
import urllib,httplib,json
from urlparse import urlparse
user = "Lucy"
url = "192.168.119.89:8080"
ports = "/auth/v1.0"
params = urllib.urlencode({})
headers = {"X-Storage-User":user,"Content-type":"application/json"}
conn = httplib.HTTPConnection(url)
conn.request("GET","%s" %ports,params,headers)
response = conn.getresponse()
data = response.read()
print response
I want to get token with curl commend. It returns nothing. What can I do if I don't want to get token with curl in other ways?
Thank you
X-Storage-Token is in the header, not in the body.
Try
token = response.getheader('X-Storage-Token')