Python wrapper for the Go implementation of the AWS4 compatible Escher HTTP request signing and authentication library.
Via PIP:
pip install escherauth-go
from escherauth_go.escher_signer import EscherSigner, EscherSignerError
try:
signer = EscherSigner('KEY', 'SECRET', 'credential/scope')
signed_headers = signer.signRequest(
'POST',
'/test/path?param=test_query',
'TEST BODY',
{'Host': 'escherauth.io'})
except EscherSignerError as e:
# Handle sign error
print(e)
from escherauth_go.escher_signer import EscherSigner, EscherSignerError
try:
signer = EscherSigner('KEY', 'SECRET', 'credential/scope')
signed_url = signer.signURL('GET', 'escherauth.io/specification.html?param=value')
except EscherSignerError as e:
# Handle sign error
print(e)
from escherauth_go.escher_validator import EscherValidator, EscherValidatorError
keyDB = [{
'keyId': 'KEY',
'secret': 'SECRET',
'acceptOnly': 0
}]
try:
validator = EscherValidator('credential/scope', keyDB)
validated_key_id = validator.validateRequest(
'POST',
'/test/path?param=test_query',
'TEST BODY',
{'Host': 'escherauth.io', 'X-EMS-Date': '...', 'X-EMS-Auth': '...'}) # Signed headers
except EscherValidatorError as e:
# Handle validation error
print(e)
from escherauth_go.escher_validator import EscherValidator, EscherValidatorError
keyDB = [{
'keyId': 'KEY',
'secret': 'SECRET',
'acceptOnly': 0
}]
try:
validator = EscherValidator('credential/scope', keyDB)
validated_key_id = validator.validateURL('GET', 'https://escherauth.io/specification.html?param=value&X-EMS-Date=...&X-EMS-Auth=...') # Signed URL
except EscherValidatorError as e:
# Handle validation error
print(e)
make test
Install xgo
docker pull karalabe/xgo-latest
go get github.com/karalabe/xgo
pip install -r requirements.txt
make build
make build/wheel
The .whl file will be created in the dist/dist folder
make dist/wheel