|
|
@ -1,5 +1,6 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
#!/usr/bin/env python3 |
|
|
|
import bz2 |
|
|
|
import bz2 |
|
|
|
|
|
|
|
import io |
|
|
|
import json |
|
|
|
import json |
|
|
|
import os |
|
|
|
import os |
|
|
|
import random |
|
|
|
import random |
|
|
@ -153,10 +154,11 @@ class Uploader(): |
|
|
|
self.last_resp = FakeResponse() |
|
|
|
self.last_resp = FakeResponse() |
|
|
|
else: |
|
|
|
else: |
|
|
|
with open(fn, "rb") as f: |
|
|
|
with open(fn, "rb") as f: |
|
|
|
data = f.read() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if key.endswith('.bz2') and not fn.endswith('.bz2'): |
|
|
|
if key.endswith('.bz2') and not fn.endswith('.bz2'): |
|
|
|
data = bz2.compress(data) |
|
|
|
data = bz2.compress(f.read()) |
|
|
|
|
|
|
|
data = io.BytesIO(data) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
data = f |
|
|
|
|
|
|
|
|
|
|
|
self.last_resp = requests.put(url, data=data, headers=headers, timeout=10) |
|
|
|
self.last_resp = requests.put(url, data=data, headers=headers, timeout=10) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|