Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

17 Commits

Repository files navigation

Escher - HTTP request signing lib Build Status

Python wrapper for the Go implementation of the AWS4 compatible Escher HTTP request signing and authentication library.

Installation

Via PIP:

pip install escherauth-go

Usage

Request Signing

fromescherauth_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)

URL Signing

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)

Request Validation

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)

URL Validation

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)

Test

make test

Build

Install build requirements

Install xgo

docker pull karalabe/xgo-latest
go get github.com/karalabe/xgo

Install python requirements

pip install -r requirements.txt
make build

Build wheel package

make build/wheel

The .whl file will be created in the dist/dist folder

Upload package

make dist/wheel

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages