okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.
MIT License
735 stars 91 forks source link

Fixes #152: Set script exit code based on request success #153

Closed stephenmuss closed 1 year ago

stephenmuss commented 1 year ago

This small change fixes #152 and ensures that the traceback from response.raise_for_status() is not included in the program's output.

Although the property response.ok uses raise_for_status() under the hood, the raised exception HTTPError is caught and a boolean value is returned.

Using the boolean value from ok we can determine whether to set a successful or unsuccessful exit code.

okigan commented 1 year ago

Thanks for the PR!, it looks like I need to fix up the GitHub actions to validate the PR (so far, it's resisting) - please stand by :D.

okigan commented 1 year ago

@stephenmuss please rebase your PR (it would be nice if GH had that feature)

stephenmuss commented 1 year ago

@okigan have rebased

okigan commented 1 year ago

You also need to update the unit test (search TestInnerMainMethod), should be straightforward.

To test locally, you can run tox or if you have docker installed, you can run act to mimic GitHub action checks.

stephenmuss commented 1 year ago

@okigan I've updated the test to check for exit code and tests are passing for me locally. Thanks.

stephenmuss commented 1 year ago

Thanks @okigan!

okigan commented 1 year ago

new build is now published on PyPI, dockerhub, and GitHub Container Registry.
Homebrew will probably self-update over the next 24 hours.

Thank you for working through this!