Python wrapper for the Go implementation of the AWS4 compatible Escher HTTP request signing and authentication library.
Via PIP:
pip install escherauth-gofromescherauth_go.escher_signerimportEscherSigner, EscherSignerErrortry: signer=EscherSigner('KEY', 'SECRET', 'credential/scope')
signed_headers=signer.signRequest(
'POST',
'/test/path?param=test_query',
'TEST BODY',
{'Host': 'escherauth.io'})
exceptEscherSignerErrorase:
# Handle sign errorprint(e)fromescherauth_go.escher_signerimportEscherSigner, EscherSignerErrortry: signer=EscherSigner('KEY', 'SECRET', 'credential/scope')
signed_url=signer.signURL('GET', 'escherauth.io/specification.html?param=value')
exceptEscherSignerErrorase:
# Handle sign errorprint(e)fromescherauth_go.escher_validatorimportEscherValidator, EscherValidatorErrorkeyDB= [{
'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 headersexceptEscherValidatorErrorase:
# Handle validation errorprint(e)fromescherauth_go.escher_validatorimportEscherValidator, EscherValidatorErrorkeyDB= [{
'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 URLexceptEscherValidatorErrorase:
# Handle validation errorprint(e)make testInstall xgo
docker pull karalabe/xgo-latest
go get github.com/karalabe/xgopip install -r requirements.txtmake buildmake build/wheelThe .whl file will be created in the dist/dist folder
make dist/wheel