https://github.com/pykit3/k3awssign
A python lib is used for adding aws version 4 signature to request.
https://github.com/pykit3/k3awssign
aws python
Last synced: 5 months ago
JSON representation
A python lib is used for adding aws version 4 signature to request.
- Host: GitHub
- URL: https://github.com/pykit3/k3awssign
- Owner: pykit3
- License: mit
- Created: 2021-08-09T04:16:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-28T12:35:49.000Z (9 months ago)
- Last Synced: 2025-12-01T08:32:47.072Z (6 months ago)
- Topics: aws, python
- Language: Python
- Homepage: https://blog.openacid.com
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k3awssign
[](https://github.com/pykit3/k3awssign/actions/workflows/python-package.yml)
[](https://k3awssign.readthedocs.io/en/stable/?badge=stable)
[](https://pypi.org/project/k3awssign)
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
```python
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 (张炎泼)
# Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼)
[pykit3]: https://github.com/pykit3