Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# # coding=utf-8
# 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']
#
# # create bucket
# # cmd = '/swift/v1/_sdad?format=json&prefix=testobj&delimiter=/'
# # cmd = '/swift/v1/_sdad?format=json&prefix=testobj&marker=testobj2&limit=10'
# # cmd = '/swift/v1/_sdad?format=json&prefix=testobj&marker=testobj2'
# cmd = '/swift/v1/_xxxxxxxxxxxxyyyy13'
# url = 'http://%s%s' % (host,cmd)
# headers = {'x-auth-token':X_Auth_Token}
# # headers['x-container-read']= ''
# headers['x-container-write']= 'yuliyang'
# # headers['x-container-read']= '.r:*'
# # headers['x-container-write']= '.r:*'
# # x-container-read: yuliyang
# # x-container-write: yuliyang #只能授权一个用户而不是一组用户
#
# # response = requests.put(url,headers=headers)
# object = '''
# date'''
# # response = requests.put(url,headers=headers,data=object)
# # response = requests.get(url,headers=headers)
# response = requests.post(url,headers=headers)
# # response = requests.head(url,headers=headers)
# data = dump.dump_all(response)
# print(data.decode('utf-8'))
#
# # list bucket
# # cmd = '/swift/v1/'
# # url = 'http://%s%s' % (host,cmd)
# # headers = {'x-auth-token':X_Auth_Token}
# # response = requests.get(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.