okigan / awscurl

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

Fixes issues with unicode hashing in python 3 #20

Closed ajmath closed 7 years ago

ajmath commented 7 years ago

I was getting exceptions when running this in python 3.6.0:

Traceback (most recent call last):
  File "/Users/amatheny/.pyenv/versions/3.6.0/bin/awscurl", line 11, in <module>
    load_entry_point('awscurl==0.8', 'console_scripts', 'awscurl')()
  File "/Users/amatheny/.pyenv/versions/3.6.0/lib/python3.6/site-packages/awscurl/awscurl.py", line 311, in main
    args.security_token
  File "/Users/amatheny/.pyenv/versions/3.6.0/lib/python3.6/site-packages/awscurl/awscurl.py", line 161, in make_request
    payload_hash = hashlib.sha256(data).hexdigest()
TypeError: Unicode-objects must be encoded before hashing

This PR fixes that issue