def main(): custom_uuid = uuid.uuid4() url='http://127.0.0.1:8080/auth/v1.0' # head={"X-Storage-User":"******","X-Storage-Pass":"******"} head={"X-Storage-User":sys.argv[1],"X-Storage-Pass":sys.argv[2]} r=requests.get(url,headers=head) url12=r.headers['x-storage-url'] auth="AUTH" tester=User(r.headers.get('x-auth-token'),r.headers.get('x-storage-token')) # print tester.xauthtoken,tester.xstoragetoken container_name = sys.argv[3].split('.')[0] test=tester.xauthtoken if test == None: print "Wrong username or password" exit(1) if auth in test: # IntialPath=os.getcwd() # print "Showing Containers!" headers={"X-Auth-Token":tester.xauthtoken} r=requests.get(os.path.join(url12,container_name),headers=headers) objectlist = r.content.split('\n') del objectlist[len(objectlist)-1] marconi_queuing.create_queue(container_name+'out',custom_uuid) for _object in objectlist: body = marconi_queuing.request_body_queue(_object,os.path.join(os.path.join(url12,container_name),_object)) message = [marconi_queuing.construct_json(body)] marconi_queuing.insert_messages(message,container_name+'out',custom_uuid)
def main(): custom_uuid = uuid.uuid4() (filename, directory,part_files) =files_in() # print filename new_filename=filename.split('.') final_filename = new_filename[0] marconi_queuing.create_queue(final_filename,custom_uuid) for part_file in part_files: body = marconi_queuing.request_body_queue(final_filename,part_file) message = [marconi_queuing.construct_json(body)] marconi_queuing.insert_messages(message,final_filename,custom_uuid)