Skip to main content

A python lib is used for adding aws version 4 signature to request.

Project description

k3awssign

Action-CI Build Status Documentation Status Package

A python lib is used for adding aws version 4 signature to request.

k3awssign is a component of pykit3 project: a python3 toolkit set.

This lib is used to sign a request using aws signature version 4. You need to provide a python dict which represent your request(it typically contains verb, uri, args, headers, body), and your access key and your secret key. This lib will add signature to the request.

Install

pip install k3awssign

Synopsis

import k3awssign
import httplib

access_key = 'your access key'
secret_key = 'your secret key'

signer = k3awssign.Signer(access_key, secret_key)

file_content = 'bla bla'
request = {
    'verb': 'PUT',
    'uri': '/test-bucket/test-key',
    'args': {
        'foo2': 'bar2',
        'foo1': True,
        'foo3': ['bar3', True],
    },
    'headers': {
        'Host': 'bscstorage.com',
        'Content-Length': len(file_content),
    },
    'body': file_content,
}

signer.add_auth(request, sign_payload=True)

conn = httplib.HTTPConnection('ss.bscstorage.com')
conn.request(request['verb'], request['uri'],
             request['body'], request['headers'])
resp = conn.getresponse()

Author

Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k3awssign-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

k3awssign-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file k3awssign-0.1.0.tar.gz.

File metadata

  • Download URL: k3awssign-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for k3awssign-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cbc6b6034f7627491e8463f81c12c4e0ebbe8e90a557204050626741e3ff9067
MD5 c5b0d9ddbf94f0491caeb128d1334694
BLAKE2b-256 1529d85517df637c9dedcbe9e56042e84746404ee044e60455ff3ab47281d0a2

See more details on using hashes here.

File details

Details for the file k3awssign-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: k3awssign-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for k3awssign-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d91dba0aa6e027265bf948f4c023cb5f1687155b7943b6487f7fa8fbfa17549
MD5 0c0fb45bf477698d7133acc0fefa4112
BLAKE2b-256 eecdb97c9ce53b066c50c564fd5ace6fd2cc674254bec379c6608171d7664e53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page