|
8 | 8 |
|
9 | 9 | from json import dumps
|
10 | 10 | from base64 import b64decode
|
11 |
| -from requests import post |
12 | 11 | from collections import Callable
|
13 | 12 | from github3.events import Event
|
14 | 13 | from github3.issues import Issue, IssueEvent, Label, Milestone, issue_params
|
@@ -329,52 +328,6 @@ def create_commit(self, message, tree, parents, author={}, committer={}):
|
329 | 328 | json = self._json(self._post(url, data=dumps(data)), 201)
|
330 | 329 | return Commit(json, self) if json else None
|
331 | 330 |
|
332 |
| - @requires_auth |
333 |
| - def create_download(self, name, path, description='', |
334 |
| - content_type='text/plain'): |
335 |
| - """Create a new download on this repository. |
336 |
| -
|
337 |
| - I do not require you provide the size in bytes because it can be |
338 |
| - determined by the operating system. |
339 |
| -
|
340 |
| - .. warning:: |
341 |
| -
|
342 |
| - On 2012-03-11, GitHub will be deprecating the Downloads API. This |
343 |
| - method will no longer work. |
344 |
| -
|
345 |
| - :param str name: (required), name of the file as it will appear |
346 |
| - :param str path: (required), path to the file |
347 |
| - :param str description: (optional), description of the file |
348 |
| - :param str content_type: (optional), e.g. 'text/plain' |
349 |
| - :returns: :class:`Download <Download>` if successful, else None |
350 |
| - """ |
351 |
| - json = None |
352 |
| - if name and path: |
353 |
| - url = self._build_url('downloads', base_url=self._api) |
354 |
| - from os import stat |
355 |
| - info = stat(path) |
356 |
| - data = {'name': name, 'size': info.st_size, |
357 |
| - 'description': description, |
358 |
| - 'content_type': content_type} |
359 |
| - json = self._json(self._post(url, data=dumps(data)), 201) |
360 |
| - |
361 |
| - if not json: |
362 |
| - return None |
363 |
| - |
364 |
| - form = [('key', json.get('path')), |
365 |
| - ('acl', json.get('acl')), |
366 |
| - ('success_action_status', '201'), |
367 |
| - ('Filename', json.get('name')), |
368 |
| - ('AWSAccessKeyId', json.get('accesskeyid')), |
369 |
| - ('Policy', json.get('policy')), |
370 |
| - ('Signature', json.get('signature')), |
371 |
| - ('Content-Type', json.get('mime_type'))] |
372 |
| - file = [('file', open(path, 'rb').read())] |
373 |
| - resp = post(json.get('s3_url'), data=form, files=file, |
374 |
| - headers={'Accept-Charset': 'utf-8'}) |
375 |
| - |
376 |
| - return Download(json, self) if self._boolean(resp, 201, 404) else None |
377 |
| - |
378 | 331 | @requires_auth
|
379 | 332 | def create_fork(self, organization=None):
|
380 | 333 | """Create a fork of this repository.
|
|
0 commit comments