Skip to content

Commit b42e35d

Browse files
committed
Still trying to figure this out.
1 parent 715e458 commit b42e35d

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

github3/repo.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
from base64 import b64decode
10-
from datetime import datetime
10+
from time import time
1111
from json import dumps
1212
import requests
1313
from .issue import Issue, Label, Milestone, issue_params
@@ -245,18 +245,21 @@ def create_download(self, name, path, description='', content_type=''):
245245
json = self._post(url, data)
246246

247247
if json:
248+
date = strptime(json.get('expirationdate'),
249+
'%Y-%m-%dT%H:%M:%S.000Z')
248250
form = [('key', json.get('path')), ('acl', json.get('acl')),
249251
('success_action_status', '201'),
250252
('Filename', json.get('name')),
253+
('Expires', int(time()) + 100),
251254
('AWSAccessKeyId', json.get('accesskeyid')),
252255
('Policy', json.get('policy')),
253256
('Signature', json.get('signature')),
254257
('Content-Type', json.get('mime_type')),
255-
('file', {json.get('name'): open(path, 'rb')})]
258+
('file', {json.get('name'): open(path, 'rb').read()})]
256259
#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,
259261
# data=form, files=files)
262+
headers = {'Accept': 'utf-8'}
260263
resp = requests.post(json.get('s3_url'), data=OrderedDict(form))
261264
#resp = requests.post('http://httpbin.org/post', headers=headers,
262265
# files=form)

github3/structs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ def __init__(self, items=[]):
1717
def __repr__(self):
1818
return 'OrderedDict({0})'.format(str(self.__items__))
1919

20+
def __setitem__(self, x, y):
21+
super(OrderedDict, self).__setitem__(x, y)
22+
self.__items__.append((x, y))
23+
2024
def items(self):
2125
return self.__items__

0 commit comments

Comments
 (0)