AWS Signature Version 4 signing for lowhaio, but with UNSIGNED-PAYLOAD
Project description
lowhaio-aws-sigv4-unsigned-payload
AWS Signature Version 4 signing for lowhaio, but with UNSIGNED-PAYLOAD. This avoids having to buffer entire objects to memory before upload to S3. However, the length of the object must be known before upload begins.
Installation
pip install lowhaio lowhaio_aws_sigv4_unsigned_payload
Usage
The request
function returned from lowhaio.Pool
must be wrapped with lowhaio_aws_sigv4_unsigned_payload.signed
, as in the below example.
import os
from lowhaio import Pool
from lowhaio_aws_sigv4_unsigned_payload import signed
request, _ = Pool()
chunk = 'abcdefghijklmnopqrstuvqxyz'
content_length = str(len(chunk) * 1000).encode()
async def body():
for _ in range(0, 1000)
yield chunk
# A coroutine that returns a tuple a tuple of access key id, secret access
# key, any other headers, such as x-amz-security-token
async def credentials():
return os.environ['AWS_ACCESS_KEY_ID'], os.environ['AWS_SECRET_ACCESS_KEY'], ()
signed_request = request(
request, credentials=credentials, service='s3', region='eu-west-1',
)
code, headers, body = await signed_request(
b'PUT', 'https://my-bucket.s3-eu-west-1.amazonaws.com/my-key', body=body
headers=((b'content-length': content_length),))
await buffered(body)
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
Built Distribution
Close
Hashes for lowhaio_aws_sigv4_unsigned_payload-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5acc181f775820cd64657fb62aaff3adc63822ef1d995488c86feb98bb74e1eb |
|
MD5 | 43e77f43ccf176a5ce22b426b05f1849 |
|
BLAKE2b-256 | b13dc7fd1690ed51880ca78ad3e9bec594d2c7bd00a001f967fa2d074c71f9b1 |
Close
Hashes for lowhaio_aws_sigv4_unsigned_payload-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d61aa8db3b888e6ffb97a9bf008b12a887577c372d9e415baa0ac8f513c58a38 |
|
MD5 | 3e768bd04f078c21536d5e0cd06fe2fe |
|
BLAKE2b-256 | 46a923d6bd7b7caf2b0dc36502f11b5324d62858ac22986bb59f720d0d3417ad |