Skip to main content

A python lib for adding AWS signature version 4 to requests

Project description

k3awssign

Action-CI 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.4.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k3awssign-0.1.4-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3awssign-0.1.4.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3awssign-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8fe55976a1f8efab4f5875da385087c53182bc06529221ce6db26417bd32b145
MD5 067c309a94ba33424912b5769068271e
BLAKE2b-256 6fb4a84b1dcd614abee2a9f5ac9328a436b54ee107c29d9a07c34c479da928fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3awssign-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3awssign-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb33fe85455edff7d2191af6b8c2d2f72cdf84edc0d67fbf6ec9033b080c41b3
MD5 e9f471c2bf2ec2952dc9643d790d5ef5
BLAKE2b-256 eb97748e63ea6e35309089838840145fcb454cff261c60caaba595a7e89c47b4

See more details on using hashes here.

Supported by

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