Skip to content

Instantly share code, notes, and snippets.

View foobarna's full-sized avatar

Bogdan Barna foobarna

View GitHub Profile
@foobarna
foobarna / transfer.py
Created July 6, 2016 09:16
transfer file from source url to Amazon S3 with aiohttp and boto3/botocore client
import asyncio
import aiohttp
import boto3
from contextlib import closing
file_url = 'http://speedtest.wdc01.softlayer.com/downloads/test100.zip'
bucket = 'some.bucket'
path = 'path/to/folder/'
kb = 1024 # bytes
@foobarna
foobarna / down.py
Last active June 2, 2018 01:10
aiohttp stream download
from contextlib import closing
import asyncio
import aiohttp
f = open('path/to/file', 'wb')
url = 'http://speedtest.wdc01.softlayer.com/downloads/test100.zip'
chunk_size = 5 * 2**20 # MB