Exemplo n.º 1
0
 def test_presigned_invalid_expires(self):
     credentials = Credentials(
         provider=Static()
     )
     presign_v4('GET', 'http://localhost:9000/hello',
                credentials, region=None, headers={}, expires=0)
                                        actual=actual_size)

                break
            except (requests.exceptions.ConnectionError, WrongSize) as e:
                logging.warn(e)
                next_retry = retry.increment(method='GET', url=url, error=e)
                if next_retry is None:
                    raise e
                else:
                    retry = next_retry
                    logging.warn(f'Retrying download: {retry}')

    download_dest.rename(dest)


credentials = Credentials(provider=Static())
client = minio.Minio('s3.amazonaws.com', credentials=credentials)


def get_url(name):
    response = client.get_object('nix-channels', name)
    return response.headers['x-amz-website-redirect-location']


def clone_images():
    DOWNLOAD_MATCH = r'nixos-\d\d.\d\d/latest-nixos-\w+-\w+-linux.\w+(.sha256)?'

    object_names = [
        x.object_name
        for x in client.list_objects_v2('nix-channels', recursive=True)
        if re.fullmatch(DOWNLOAD_MATCH, x.object_name)
Exemplo n.º 3
0
 def test_presigned_no_access_key(self):
     credentials = Credentials(
         provider=Static()
     )
     presign_v4('GET', 'http://localhost:9000/hello', credentials, None)