class FileLimiter(object):

    def __init__(self, file_obj, read_limit):
        self.read_limit = read_limit
self.amount_seen = 0
self.file_obj = file_obj
self.len = read_limit

def read(self, amount=-1):
    if self.amount_seen >= self.read_limit:
        return ''
remaining_amount = self.read_limit - self.amount_seen
data = self.file_obj.read(min(amount, remaining_amount))
self.amount_seen += len(data)
return data
requests - how to stream upload - partial file