Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import requests
from requests_toolbelt.utils import dump
host = '10.254.3.68:7480'
cmd = '/auth/1.0'
url = 'http://%s%s' % (host,cmd)
user = 'yuliyang:yuliyang'
key = 'OssHz2Ga1rrb49sYTAS5bih8VKWnZhxQlJDC2m48'
user = 'testuser:testuser'
key = 'NxPBANyfYVYwvQXQHfRrsi8lBn81dRHAm3S9C3Nj'
headers = {'x-auth-key':key,'x-auth-user':user}
response = requests.get(url,headers=headers)
data = dump.dump_all(response)
print(data.decode('utf-8'))
X_Auth_Token = response.headers['X-Auth-Token']
cmd = '/swift/v1/xxxxxxxxxxxxyyyy13'
url = 'http://%s%s' % (host,cmd)
headers = {'x-auth-token':X_Auth_Token}
response = requests.put(url,headers=headers)
data = dump.dump_all(response)
print(data.decode('utf-8'))
cmd = '/swift/v1/xxxxxxxxxxxxyyyy13'
url = 'http://%s%s' % (host,cmd)
headers = {'x-auth-token':X_Auth_Token}
response = requests.put(url,headers=headers)
data = dump.dump_all(response)
print(data.decode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.