python_swift_project_swift使用

1. swift的存取用curl命令. 我们先把pub url 和token保存起来

root@A071103070098:~# export pubURL=http://10.194.148.102:8080/v2.0/AUTH_ed03db73438343848db63062d7fd9271
root@A071103070098:~# export mytoken=MIIGKwYJKoZIhvcNAQcCoIIGHDCCBhgCAQExCTAHBgUrDgMCGjCCBIEGCSqGSIb3DQEHAaCCBHIEggRueyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wOS0wNlQwNzoyOTowMS40NTk3NzEiLCAiZXhwaXJlcyI6ICIyMDE0LTA5LTA2VDA4OjI5OjAxWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIkRlZmF1bHQgVGVuYW50IiwgImVuYWJsZWQiOiB0cnVlLCAiaWQiOiAiZWQwM2RiNzM0MzgzNDM4NDhkYjYzMDYyZDdmZDkyNzEiLCAibmFtZSI6ICJhZG1pbiJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzEwLjE5NC4xNDguMTAyOjgwODAvdjEiLCAicmVnaW9uIjogIlJlZ2lvbk9uZSIsICJpbnRlcm5hbFVSTCI6ICJodHRwOi8vMTAuMTk0LjE0OC4xMDI6ODA4MC92MS9BVVRIX2VkMDNkYjczNDM4MzQzODQ4ZGI2MzA2MmQ3ZmQ5MjcxIiwgImlkIjogIjRkNGFhZWViYmNmNzQxNDI4YjAwN2Q0ZTFlZmJhZTgwIiwgInB1YmxpY1VSTCI6ICJodHRwOi8vMTAuMTk0LjE0OC4xMDI6ODA4MC92MS9BVVRIX2VkMDNkYjczNDM4MzQzODQ4ZGI2MzA2MmQ3ZmQ5MjcxIn1dLCAiZW5kcG9pbnRzX2xpbmtzIjogW10sICJ0eXBlIjogIm9iamVjdC1zdG9yZSIsICJuYW1lIjogInN3aWZ0In0sIHsiZW5kcG9pbnRzIjogW3siYWR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TjN14jidA5t9AJvEsRE7ezx0AJ1xqvuDs7A3a0npXwi+G8+A85ycVvyjEvJfMb15yxtnA4E6v2y-xqNH94MKDc9wEEbxsyg3f0OI3e3vzKAQ1vQ=

2. swift 获得验证信息

root@A071103070098:~# export pubURL=http://10.194.148.102:8080/v2.0/AUTH_ed03db73438343848db63062d7fd9271
root@A071103070098:~# export mytoken=MIIGKwYJKoZIhvcNAQcCoIIGHDCCBhgCAQExCTAHBgUrDgMCGjCCBIEGCSqGSIb3DQEHAaCCBHIEggRueyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wOS0wNlQwNzoyOTowMS40NTk3NzEiLCAiZXhwaXJlcyI6ICIyMDE0LTA5LTA2VDA4OjI5OjAxWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIkRlZmF1bHQgVGVuYW50IiwgImVuYWJsZWQiOiB0cnVlLCAiaWQiOiAiZWQwM2RiNzM0MzgzNDM4NDhkYjYzMDYyZDdmZDkyNzEiLCAibmFtZSI6ICJhZG1pbiJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzEwLjE5NC4xNDguMTAyOjgwODAvdjEiLCAicmVnaW9uIjogIlJlZ2lvbk9uZSIsICJpbnRlcm5hbFVSTCI6ICJodHRwOi8vMTAuMTk0LjE0OC4xMDI6ODA4MC92MS9BVVRIX2VkMDNkYjczNDM4MzQzODQ4ZGI2MzA2MmQ3ZmQ5MjcxIiwgImlkIjogIjRkNGFhZWViYmNmNzQxNDI4YjAwN2Q0ZTFlZmJhZTgwIiwgInB1YmxpY1VSTCI6ICJodHRwOi8vMTAuMTk0LjE0OC4xMDI6ODA4MC92MS9BVVRIX2VkMDNkYjczNDM4MzQzODQ4ZGI2MzA2MmQ3ZmQ5MjcxIn1dLCAiZW5kcG9pbnRzX2xpbmtzI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sdwYa-4cJgKY3ypoUm8yL0NpQa-Mk2NJSlShKIaNnzMMHLJTaSX5nXCJf8QXUE1yHUswn0gyYal0MEn-vNtTjN14jidA5t9AJvEsRE7ezx0AJ1xqvuDs7A3a0npXwi+G8+A85ycVvyjEvJfMb15yxtnA4E6v2y-xqNH94MKDc9wEEbxsyg3f0OI3e3vzKAQ1vQ=

 

3. swift获取一个account的信息

root@A071103070098:~# curl -i $pubURL?format=xml X GET -H "X-Auth-Token:$mytoken" 
HTTP/1.0 200 OK
Content-Type: application/xml; charset=utf-8
X-Account-Object-Count: 0
X-Timestamp: 1409991063.88358
X-Account-Bytes-Used: 0
X-Account-Container-Count: 0
X-Put-Timestamp: 1409991063.88358
X-Trans-Id: tx2c2521cc353e4d5d9d12f-00540ac197
Date: Sat, 06 Sep 2014 08:11:03 GMT
Content-Length: 104
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<account name="AUTH_ed03db73438343848db63062d7fd9271">
</account>HTTP/1.0 503 Service Unavailable
Date: Sat, 06 Sep 2014 07:55:26 GMT
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Content-Length: 675
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<HTML><HEAD>
<TITLE>Network Error</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Network Error (dns_server_failure)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
Your request could not be processed because an error occurred contacting the DNS server.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
The DNS server may be temporarily unavailable, or there could be a network problem.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
 
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
HTTP/1.0 302 Moved Temporarily
Date: Sat, 06 Sep 2014 07:55:27 GMT
Server: BlueCoat-Security-Appliance/1.1.00
Location: http://www.get.com/
Content-Length: 90
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<HTML>
<HEAD><TITLE>Redirection</TITLE></HEAD>
<BODY><H1>Redirect</H1></BODY>
</HTML>
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# 
root@A071103070098:~# curl -i $pubURL?format=xml X GET -H "X-Auth-Token:$mytoken" 
HTTP/1.0 200 OK
Content-Type: application/xml; charset=utf-8
X-Account-Object-Count: 0
X-Timestamp: 1409991214.82764
X-Account-Bytes-Used: 0
X-Account-Container-Count: 0
X-Put-Timestamp: 1409991214.82764
X-Trans-Id: tx7b3eaa212b0b44d9a899d-00540ac22e
Date: Sat, 06 Sep 2014 08:13:34 GMT
Content-Length: 104
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<account name="AUTH_ed03db73438343848db63062d7fd9271">
</account>HTTP/1.0 503 Service Unavailable
Date: Sat, 06 Sep 2014 07:57:57 GMT
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Content-Length: 675
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<HTML><HEAD>
<TITLE>Network Error</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Network Error (dns_server_failure)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
Your request could not be processed because an error occurred contacting the DNS server.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
The DNS server may be temporarily unavailable, or there could be a network problem.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
 
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
HTTP/1.0 302 Moved Temporarily
Date: Sat, 06 Sep 2014 07:57:58 GMT
Server: BlueCoat-Security-Appliance/1.1.00
Location: http://www.get.com/
Content-Length: 90
X-Cache: MISS from NS-M46903639710
X-Cache-Lookup: MISS from NS-M46903639710:8080
Connection: close

<HTML>
<HEAD><TITLE>Redirection</TITLE></HEAD>
<BODY><H1>Redirect</H1></BODY>
</HTML>

 

posted on 2014-09-06 15:47  kramer  阅读(321)  评论(0编辑  收藏  举报

导航