Skip to content

Commit

Permalink
no need to override headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
willgraf committed Jun 25, 2020
1 parent 94dbb17 commit dbdd240
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kiosk_client/job.py
Expand Up @@ -226,14 +226,11 @@ def _retry_post_request_wrapper(self, host, name='REDIS', **kwargs):
@defer.inlineCallbacks
def upload_file(self):
host = '{}/api/upload'.format(self.host)
headers = self.headers.copy()
headers['Content-Type'] = ['multipart/form-data']
name = 'UPLOAD {}'.format(self.filepath)
with open(self.filepath, 'rb') as f:
payload = {'file': (self.filepath, f)}
response = yield self._retry_post_request_wrapper(host, name,
files=payload,
headers=headers)
response = yield self._retry_post_request_wrapper(
host, name, files=payload, headers=self.headers)
uploaded_path = response.get('uploadedName')
defer.returnValue(uploaded_path) # "return" the value

Expand Down

0 comments on commit dbdd240

Please sign in to comment.