def test_presigned_invalid_expires(self): credentials = Credentials(provider=Static()) presign_v4('GET', 'http://localhost:9000/hello', credentials, region=None, headers={}, expires=0)
def parse_minio_credentials(credentials): if credentials: access_key = credentials['AccessKeyId'] secret_key = credentials['SecretAccessKey'] session_token = credentials.get('SessionToken', None) mc_credentials = Credentials( provider=Static(access_key, secret_key, session_token)) else: mc_credentials = None return mc_credentials
def test_signv4(self): # Construct target url. credentials = Credentials( provider=Static( access_key='minio', secret_key='minio123' ) ) url = get_target_url('http://localhost:9000', bucket_name='testbucket', object_name='~testobject', bucket_region='us-east-1', query={'partID': '1', 'uploadID': '~abcd'}) hdrs = sign_v4('PUT', url, 'us-east-1', credentials=credentials, request_datetime=dt) eq_(hdrs['Authorization'], 'AWS4-HMAC-SHA256 Credential=minio/20150620/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=a2f4546f647981732bd90dfa5a7599c44dca92f44bea48ecc7565df06032c25b')
def test_presigned_versioned_id(self): credentials = Credentials(provider=Static("minio", "minio123"), ) url = presign_v4( 'GET', 'http://localhost:9000/bucket-name/objectName?versionId=uuid', credentials, region='us-east-1', headers={}, request_date=dt) eq_( url, 'http://localhost:9000/bucket-name/objectName?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20150620%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20150620T010203Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&versionId=uuid&X-Amz-Signature=3ce13e2ca929fafa20581a05730e4e9435f2a5e20ec7c5a082d175692fb0a663' )
def test_presigned_no_access_key(self): credentials = Credentials(provider=Static()) presign_v4('GET', 'http://localhost:9000/hello', credentials, None)
next_retry = retry.increment( method='GET', url=url, error=e ) if next_retry is None: global failure failure = True raise e else: retry = next_retry logging.warning(f'Retrying download: {retry}') download_dest.rename(dest) credentials = Credentials(provider=Static()) client = minio.Minio('s3.amazonaws.com', credentials=credentials) def get_channels(): return [ (x.object_name, x.last_modified) for x in client.list_objects_v2('nix-channels') if re.fullmatch(r'(nixos|nixpkgs)-.+[^/]', x.object_name) ] def clone_channels(): logging.info(f'- Fetching channels') channels_to_update = [] working_dir.mkdir(parents=True, exist_ok=True)