Skip to content

Commit 31274e1

Browse files
improve file uploading to TestingBot Storage
1 parent 770a27a commit 31274e1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setuptools.setup(
1111
name='testingbotclient',
12-
version='0.1.1',
12+
version='0.1.2',
1313
py_modules=['testingbotclient'],
1414
author='TestingBot',
1515
author_email='[email protected]',

testingbotclient.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,12 @@ def __init__(self, client):
128128

129129
def upload_local_file(self, filepath):
130130
"""Uploads a local file to TestingBot Storage."""
131-
with open(filepath, 'rb') as f: file_contents = f.read()
132-
return requests.post(self.client.api_url + "/storage", files={'file': file_contents}, auth=(self.client.testingbotKey, self.client.testingbotSecret)).json()
131+
with open(filepath, 'rb') as f:
132+
return requests.post(
133+
self.client.api_url + "/storage",
134+
files={'file': f},
135+
auth=(self.client.testingbotKey, self.client.testingbotSecret)
136+
).json()
133137

134138
def upload_remote_file(self, remoteUrl):
135139
return self.client.post("/storage", { 'url': remoteUrl })

0 commit comments

Comments
 (0)