youtype / botocore-stubs

Type annotations and code completion for botocore package
https://youtype.github.io/mypy_boto3_builder/
MIT License
3 stars 3 forks source link

SigV4Auth.signature() has incorrect return type #9

Closed tungol closed 9 months ago

tungol commented 9 months ago

Hi!

The return type of botocore.auth.SigV4Auth.signature() should be str, not bytes:

https://github.com/youtype/botocore-stubs/blob/main/botocore-stubs/auth.pyi#L60

The return value is here: https://github.com/boto/botocore/blob/1bf422484a5abca0304d328b9ee2d91801acd2d6/botocore/auth.py#L414

which is calling the internal _sign function with hex=True:

https://github.com/boto/botocore/blob/1bf422484a5abca0304d328b9ee2d91801acd2d6/botocore/auth.py#L224

So it's getting hmac.new().hexdigest(), and that's str: https://github.com/python/typeshed/blob/main/stdlib/hmac.pyi#L42

Thanks for all your work!

vemel commented 9 months ago

I just published botocore-stubs 1.33.6.post1 with the fix included.