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

get_object() got an unexpected keyword argument 'RequestPayer' #22

Open
philvarner opened this issue Apr 25, 2023 · 1 comment
Open

Comments

@philvarner
Copy link
Collaborator

With

boto3==1.24.59
botocore==1.27.59
boto3-utils==0.4.0

This exception happens when trying to use requester pays:

ERROR    task.py:250 get_object() got an unexpected keyword argument 'RequestPayer'
Traceback (most recent call last):
  File ".venv/lib/python3.9/site-packages/stactask/task.py", line 242, in handler
    items = task.process(**task.parameters)
  File "task.py", line 262, in process
    v0_json = s3_client.read_json(v0_url)
  File ".venv/lib/python3.9/site-packages/boto3utils/s3.py", line 259, in read_json
    return json.loads(self.read(url))
  File ".venv/lib/python3.9/site-packages/boto3utils/s3.py", line 251, in read
    response = self.get_object(parts['bucket'], parts['key'], **kwargs)
TypeError: get_object() got an unexpected keyword argument 'RequestPayer'

from code:

        kwargs = {}
        if self.requester_pays:
            kwargs["RequestPayer"] = "requester"
        response = self.get_object(parts['bucket'], parts['key'], **kwargs)

I believe it's expecting an ExtraArgs parameter instead of RequestPayer directly, but I've been unable to find exactly where that's documented and for which version of boto3.

@matthewhanson
Copy link
Owner

I see, looks like a problem with just the read function because it's passing in requester pays to s3.get_object, but s3.get_object is just getting the requester pays attribute for the whole session, so the read function should not check for it and try to pass it in.

Temp workaround would be to just download the file then read it from disk.

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

No branches or pull requests

2 participants