Skip to content

EscherAuth/escher-python

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

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)

URL Signing

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)

Request Validation

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)

URL Validation

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)

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

Watchers

Forks

Releases

No releases published

Packages

No packages published