Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs: Use no_sign_request to fix "NoCredentials" Error when trying to access a public S3 bucket #271

Closed
torrinworx opened this issue Sep 13, 2022 · 1 comment · Fixed by #307

Comments

@torrinworx
Copy link

I've outlined this issue in more depth here: https://stackoverflow.com/q/73708204/15739035

But essentially just using this simple code:

from cloudpathlib import CloudPath
path = r"C:\some\path\to\folder"
url = "s3://some-example-bucket/folder/"

cloud_path = CloudPath(url)
cloud_path.download_to(path)

I'm unable to download a folder from this S3 bucket: s3://cozy-auto-texture-sd-repo/stable-diffusion-v1-4/

Now this bucket needs to be public so I can distribute a repository to my users, and anyone needs to be able to access it. For some reason whenever I run the above code with that s3:// link, cloudpathlib gives the following error:

  File "E:\Cozy-Auto-Texture-Files\venv\lib\site-packages\botocore\auth.py", line 418, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
@pjbull
Copy link
Member

pjbull commented Sep 14, 2022

@torrinworx Like with boto3 directly, in order to access public resources anonymously you need to pass no_sign_request=True when you instantiate the S3Client (you can find examples here).

We'd take a PR that updates that authentication docs page to have an example accessing a public bucket so this is eaiser for other folks to find as well.

@pjbull pjbull changed the title "NoCredentials" Error when trying to download a folder object from public access bucket on AWS S3. Update docs: Use no_sign_request to fix "NoCredentials" Error when trying to access a public S3 bucket Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants