|
7 | 7 | """ |
8 | 8 |
|
9 | 9 | from base64 import b64decode |
10 | | -from datetime import datetime |
| 10 | +from time import time |
11 | 11 | from json import dumps |
12 | 12 | import requests |
13 | 13 | from .issue import Issue, Label, Milestone, issue_params |
@@ -245,18 +245,21 @@ def create_download(self, name, path, description='', content_type=''): |
245 | 245 | json = self._post(url, data) |
246 | 246 |
|
247 | 247 | if json: |
| 248 | + date = strptime(json.get('expirationdate'), |
| 249 | + '%Y-%m-%dT%H:%M:%S.000Z') |
248 | 250 | form = [('key', json.get('path')), ('acl', json.get('acl')), |
249 | 251 | ('success_action_status', '201'), |
250 | 252 | ('Filename', json.get('name')), |
| 253 | + ('Expires', int(time()) + 100), |
251 | 254 | ('AWSAccessKeyId', json.get('accesskeyid')), |
252 | 255 | ('Policy', json.get('policy')), |
253 | 256 | ('Signature', json.get('signature')), |
254 | 257 | ('Content-Type', json.get('mime_type')), |
255 | | - ('file', {json.get('name'): open(path, 'rb')})] |
| 258 | + ('file', {json.get('name'): open(path, 'rb').read()})] |
256 | 259 | #files = {json.get('name'): open(path, 'rb')} |
257 | | - #headers = {'Content-Type': 'multipart/form-data'} |
258 | | - # resp = requests.post(json.get('s3_url'), # headers=headers, |
| 260 | + #resp = requests.post(json.get('s3_url'), # headers=headers, |
259 | 261 | # data=form, files=files) |
| 262 | + headers = {'Accept': 'utf-8'} |
260 | 263 | resp = requests.post(json.get('s3_url'), data=OrderedDict(form)) |
261 | 264 | #resp = requests.post('http://httpbin.org/post', headers=headers, |
262 | 265 | # files=form) |
|
0 commit comments