Git Product home page Git Product logo

Comments (7)

simonw avatar simonw commented on July 19, 2024

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_object

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_object

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

Design for put-object:

s3-credentials put-object my-bucket my-pictures/panda.jpg panda.jpg

Or:

echo "Content" | s3-credentials put-object my-bucket my-key.txt -

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

For get-object:

s3-credentials get-object my-bucket my-key.txt # Outputs to standard output

Or:

s3-credentials get-object my-bucket my-key.txt -o file.txt

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

Maybe in the future add --acl to put-object - from the boto docs:

ACL='private'|'public-read'|'public-read-write'|'authenticated-read'|'aws-exec-read'|'bucket-owner-read'|'bucket-owner-full-control'

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

Tried this:

@cli.command()
@click.argument("bucket")
@click.argument("key")
@click.argument("body", type=click.File("rb"))
@common_boto3_options
def put_object(bucket, key, body, **boto_options):
    "Upload an object to an S3 bucket"
    s3 = make_client("s3", **boto_options)
    response = s3.put_object(Body=body, Bucket=bucket, Key=key)
    click.echo(json.dumps(response, indent=4, default=str))

And got this error:

 % echo "Hello world" | s3-credentials put-object static.niche-museums.com hello.txt -
Traceback (most recent call last):
...
  File "/Users/simon/.local/share/virtualenvs/s3-credentials-J8M1ChYK/lib/python3.10/site-packages/botocore/utils.py", line 2434, in _calculate_md5_from_file
    start_position = fileobj.tell()
OSError: [Errno 29] Illegal seek

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

I should use this module, it handles lots of interesting extra features, including progress bars: https://github.com/boto/boto3/blob/c5487b57499ad354e24ca2c8622f90fe089240b6/boto3/s3/transfer.py

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

I'm going to test these as part of the existing integration tests.

from s3-credentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.