{"action":"created","comment":{"url":"https://api.github.com/repos/boto/boto3/pulls/comments/71657258","id":71657258,"diff_hunk":"@@ -356,3 +367,267 @@ def object_copy(self, CopySource, ExtraArgs=None, Callback=None,\n         CopySource=CopySource, Bucket=self.bucket_name, Key=self.key,\n         ExtraArgs=ExtraArgs, Callback=Callback, SourceClient=SourceClient,\n         Config=Config)\n+\n+\n+def upload_fileobj(self, Fileobj, Bucket, Key, ExtraArgs=None,\n+                   Callback=None, Config=None):\n+    \"\"\"Upload a file-like object to S3.\n+\n+    This is a managed transfer which will perform a multipart upload in\n+    multiple threads if necessary.\n+\n+    Usage::\n+\n+        import io\n+        import boto3\n+        data = io.BytesIO(b'foo')\n+        s3 = boto3.client('s3')\n+        s3.upload_fileobj(data, 'mybucket', 'mykey')\n+\n+    :type Fileobj: a file-like object\n+    :param Fileobj: A file-like object to upload. At a minimum, it must\n+        implement the `read` method.\n+\n+    :type Bucket: str\n+    :param Bucket: The name of the bucket to upload to.\n+\n+    :type Key: str\n+    :param Key: The name of the key to upload to.\n+\n+    :type ExtraArgs: dict\n+    :param ExtraArgs: Extra arguments that may be passed to the\n+        client operation.\n+\n+    :type Callback: method\n+    :param Callback: A method which takes a number of bytes transferred to\n+        be periodically called during the upload.\n+\n+    :type Config: boto3.s3.transfer.TransferConfig\n+    :param Config: The transfer configuration to be used when performing the\n+        upload.\n+    \"\"\"\n+    subscribers = None\n+    if Callback is not None:\n+        subscribers = [ProgressCallbackInvoker(Callback)]\n+\n+    config = Config\n+    if config is None:\n+        config = TransferConfig()\n+\n+    with TransferManager(self, config) as manager:\n+        future = manager.upload(\n+            fileobj=Fileobj, bucket=Bucket, key=Key,\n+            extra_args=ExtraArgs, subscribers=subscribers)\n+        return future.result()\n+\n+\n+def bucket_upload_fileobj(self, Fileobj, Key, ExtraArgs=None,\n+                          Callback=None, Config=None):\n+    \"\"\"Upload a file-like object to this bucket.\n+\n+    This is a managed transfer which will perform a multipart upload in\n+    multiple threads if necessary.\n+\n+    Usage::\n+\n+        import io\n+        import boto3\n+        data = io.BytesIO(b'foo')\n+        s3 = boto3.resource('s3')\n+        bucket = s3.Bucket('mybucket')\n+        bucket.upload_fileobj(data, 'mykey')\n+\n+    :type Fileobj: a file-like object\n+    :param Fileobj: A file-like object to upload. At a minimum, it must\n+        implement the `read` method.\n+\n+    :type Key: str\n+    :param Key: The name of the key to upload to.\n+\n+    :type ExtraArgs: dict\n+    :param ExtraArgs: Extra arguments that may be passed to the\n+        client operation.\n+\n+    :type Callback: method\n+    :param Callback: A method which takes a number of bytes transferred to\n+        be periodically called during the upload.\n+\n+    :type Config: boto3.s3.transfer.TransferConfig\n+    :param Config: The transfer configuration to be used when performing the\n+        upload.\n+    \"\"\"\n+    return self.meta.client.upload_fileobj(\n+        Fileobj=Fileobj, Bucket=self.name, Key=Key, ExtraArgs=ExtraArgs,\n+        Callback=Callback, Config=Config)\n+\n+\n+def object_upload_fileobj(self, Fileobj, ExtraArgs=None, Callback=None,\n+                          Config=None):\n+    \"\"\"Upload a file-like object to this object.\n+\n+    This is a managed transfer which will perform a multipart upload in\n+    multiple threads if necessary.\n+\n+    Usage::\n+\n+        import io\n+        import boto3\n+        data = io.BytesIO(b'foo')\n+        s3 = boto3.resource('s3')\n+        bucket = s3.Bucket('mybucket')\n+        obj = bucket.Object('mykey')\n+        obj.upload_fileobj(data)\n+\n+    :type Fileobj: a file-like object\n+    :param Fileobj: A file-like object to upload. At a minimum, it must\n+        implement the `read` method.\n+\n+    :type ExtraArgs: dict\n+    :param ExtraArgs: Extra arguments that may be passed to the\n+        client operation.\n+\n+    :type Callback: method\n+    :param Callback: A method which takes a number of bytes transferred to\n+        be periodically called during the upload.\n+\n+    :type Config: boto3.s3.transfer.TransferConfig\n+    :param Config: The transfer configuration to be used when performing the\n+        upload.\n+    \"\"\"\n+    return self.meta.client.upload_fileobj(\n+        Fileobj=Fileobj, Bucket=self.bucket_name, Key=self.key,\n+        ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)\n+\n+\n+def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None,\n+                     Callback=None, Config=None):\n+    \"\"\"Download an object from S3 to a file-like object.\n+\n+    This is a managed transfer which will perform a multipart download in\n+    multiple threads if necessary.\n+\n+    Usage::\n+\n+        import io","path":"boto3/s3/inject.py","position":47,"original_position":177,"commit_id":"4678021508c38eafd997c7d066be9a1189a67319","original_commit_id":"4678021508c38eafd997c7d066be9a1189a67319","user":{"login":"kyleknap","id":4605355,"avatar_url":"https://avatars.githubusercontent.com/u/4605355?v=3","gravatar_id":"","url":"https://api.github.com/users/kyleknap","html_url":"https://github.com/kyleknap","followers_url":"https://api.github.com/users/kyleknap/followers","following_url":"https://api.github.com/users/kyleknap/following{/other_user}","gists_url":"https://api.github.com/users/kyleknap/gists{/gist_id}","starred_url":"https://api.github.com/users/kyleknap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyleknap/subscriptions","organizations_url":"https://api.github.com/users/kyleknap/orgs","repos_url":"https://api.github.com/users/kyleknap/repos","events_url":"https://api.github.com/users/kyleknap/events{/privacy}","received_events_url":"https://api.github.com/users/kyleknap/received_events","type":"User","site_admin":false},"body":"I think we should make an example using open(filename, 'wb') as well","created_at":"2016-07-21T07:17:19Z","updated_at":"2016-07-21T07:17:19Z","html_url":"https://github.com/boto/boto3/pull/724#discussion_r71657258","pull_request_url":"https://api.github.com/repos/boto/boto3/pulls/724","_links":{"self":{"href":"https://api.github.com/repos/boto/boto3/pulls/comments/71657258"},"html":{"href":"https://github.com/boto/boto3/pull/724#discussion_r71657258"},"pull_request":{"href":"https://api.github.com/repos/boto/boto3/pulls/724"}}},"pull_request":{"url":"https://api.github.com/repos/boto/boto3/pulls/724","id":78226990,"html_url":"https://github.com/boto/boto3/pull/724","diff_url":"https://github.com/boto/boto3/pull/724.diff","patch_url":"https://github.com/boto/boto3/pull/724.patch","issue_url":"https://api.github.com/repos/boto/boto3/issues/724","number":724,"state":"open","locked":false,"title":"Add managed file-like object S3 transfers","user":{"login":"JordonPhillips","id":2643092,"avatar_url":"https://avatars.githubusercontent.com/u/2643092?v=3","gravatar_id":"","url":"https://api.github.com/users/JordonPhillips","html_url":"https://github.com/JordonPhillips","followers_url":"https://api.github.com/users/JordonPhillips/followers","following_url":"https://api.github.com/users/JordonPhillips/following{/other_user}","gists_url":"https://api.github.com/users/JordonPhillips/gists{/gist_id}","starred_url":"https://api.github.com/users/JordonPhillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordonPhillips/subscriptions","organizations_url":"https://api.github.com/users/JordonPhillips/orgs","repos_url":"https://api.github.com/users/JordonPhillips/repos","events_url":"https://api.github.com/users/JordonPhillips/events{/privacy}","received_events_url":"https://api.github.com/users/JordonPhillips/received_events","type":"User","site_admin":false},"body":"This adds transfer methods for both uploading from and downloading to file-like objects.\n\ncc @kyleknap @jamesls","created_at":"2016-07-20T22:00:00Z","updated_at":"2016-07-21T07:17:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5329cff824ecbe0fbe350713f009bf210c6484b8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/boto/boto3/pulls/724/commits","review_comments_url":"https://api.github.com/repos/boto/boto3/pulls/724/comments","review_comment_url":"https://api.github.com/repos/boto/boto3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/boto/boto3/issues/724/comments","statuses_url":"https://api.github.com/repos/boto/boto3/statuses/4678021508c38eafd997c7d066be9a1189a67319","head":{"label":"JordonPhillips:fileobj-transfer","ref":"fileobj-transfer","sha":"4678021508c38eafd997c7d066be9a1189a67319","user":{"login":"JordonPhillips","id":2643092,"avatar_url":"https://avatars.githubusercontent.com/u/2643092?v=3","gravatar_id":"","url":"https://api.github.com/users/JordonPhillips","html_url":"https://github.com/JordonPhillips","followers_url":"https://api.github.com/users/JordonPhillips/followers","following_url":"https://api.github.com/users/JordonPhillips/following{/other_user}","gists_url":"https://api.github.com/users/JordonPhillips/gists{/gist_id}","starred_url":"https://api.github.com/users/JordonPhillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordonPhillips/subscriptions","organizations_url":"https://api.github.com/users/JordonPhillips/orgs","repos_url":"https://api.github.com/users/JordonPhillips/repos","events_url":"https://api.github.com/users/JordonPhillips/events{/privacy}","received_events_url":"https://api.github.com/users/JordonPhillips/received_events","type":"User","site_admin":false},"repo":{"id":41875903,"name":"boto3","full_name":"JordonPhillips/boto3","owner":{"login":"JordonPhillips","id":2643092,"avatar_url":"https://avatars.githubusercontent.com/u/2643092?v=3","gravatar_id":"","url":"https://api.github.com/users/JordonPhillips","html_url":"https://github.com/JordonPhillips","followers_url":"https://api.github.com/users/JordonPhillips/followers","following_url":"https://api.github.com/users/JordonPhillips/following{/other_user}","gists_url":"https://api.github.com/users/JordonPhillips/gists{/gist_id}","starred_url":"https://api.github.com/users/JordonPhillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordonPhillips/subscriptions","organizations_url":"https://api.github.com/users/JordonPhillips/orgs","repos_url":"https://api.github.com/users/JordonPhillips/repos","events_url":"https://api.github.com/users/JordonPhillips/events{/privacy}","received_events_url":"https://api.github.com/users/JordonPhillips/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JordonPhillips/boto3","description":"AWS SDK for Python","fork":true,"url":"https://api.github.com/repos/JordonPhillips/boto3","forks_url":"https://api.github.com/repos/JordonPhillips/boto3/forks","keys_url":"https://api.github.com/repos/JordonPhillips/boto3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JordonPhillips/boto3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JordonPhillips/boto3/teams","hooks_url":"https://api.github.com/repos/JordonPhillips/boto3/hooks","issue_events_url":"https://api.github.com/repos/JordonPhillips/boto3/issues/events{/number}","events_url":"https://api.github.com/repos/JordonPhillips/boto3/events","assignees_url":"https://api.github.com/repos/JordonPhillips/boto3/assignees{/user}","branches_url":"https://api.github.com/repos/JordonPhillips/boto3/branches{/branch}","tags_url":"https://api.github.com/repos/JordonPhillips/boto3/tags","blobs_url":"https://api.github.com/repos/JordonPhillips/boto3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JordonPhillips/boto3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JordonPhillips/boto3/git/refs{/sha}","trees_url":"https://api.github.com/repos/JordonPhillips/boto3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JordonPhillips/boto3/statuses/{sha}","languages_url":"https://api.github.com/repos/JordonPhillips/boto3/languages","stargazers_url":"https://api.github.com/repos/JordonPhillips/boto3/stargazers","contributors_url":"https://api.github.com/repos/JordonPhillips/boto3/contributors","subscribers_url":"https://api.github.com/repos/JordonPhillips/boto3/subscribers","subscription_url":"https://api.github.com/repos/JordonPhillips/boto3/subscription","commits_url":"https://api.github.com/repos/JordonPhillips/boto3/commits{/sha}","git_commits_url":"https://api.github.com/repos/JordonPhillips/boto3/git/commits{/sha}","comments_url":"https://api.github.com/repos/JordonPhillips/boto3/comments{/number}","issue_comment_url":"https://api.github.com/repos/JordonPhillips/boto3/issues/comments{/number}","contents_url":"https://api.github.com/repos/JordonPhillips/boto3/contents/{+path}","compare_url":"https://api.github.com/repos/JordonPhillips/boto3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JordonPhillips/boto3/merges","archive_url":"https://api.github.com/repos/JordonPhillips/boto3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JordonPhillips/boto3/downloads","issues_url":"https://api.github.com/repos/JordonPhillips/boto3/issues{/number}","pulls_url":"https://api.github.com/repos/JordonPhillips/boto3/pulls{/number}","milestones_url":"https://api.github.com/repos/JordonPhillips/boto3/milestones{/number}","notifications_url":"https://api.github.com/repos/JordonPhillips/boto3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JordonPhillips/boto3/labels{/name}","releases_url":"https://api.github.com/repos/JordonPhillips/boto3/releases{/id}","deployments_url":"https://api.github.com/repos/JordonPhillips/boto3/deployments","created_at":"2015-09-03T18:13:38Z","updated_at":"2016-01-21T20:41:00Z","pushed_at":"2016-07-20T21:57:50Z","git_url":"git://github.com/JordonPhillips/boto3.git","ssh_url":"git@github.com:JordonPhillips/boto3.git","clone_url":"https://github.com/JordonPhillips/boto3.git","svn_url":"https://github.com/JordonPhillips/boto3","homepage":"http://aws.amazon.com/sdk-for-python/","size":1104,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"boto:port-s3transfer","ref":"port-s3transfer","sha":"e48e45ed4291ef41e29af977cb1595ad41dd9762","user":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"repo":{"id":24774658,"name":"boto3","full_name":"boto/boto3","owner":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/boto/boto3","description":"AWS SDK for Python","fork":false,"url":"https://api.github.com/repos/boto/boto3","forks_url":"https://api.github.com/repos/boto/boto3/forks","keys_url":"https://api.github.com/repos/boto/boto3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boto/boto3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boto/boto3/teams","hooks_url":"https://api.github.com/repos/boto/boto3/hooks","issue_events_url":"https://api.github.com/repos/boto/boto3/issues/events{/number}","events_url":"https://api.github.com/repos/boto/boto3/events","assignees_url":"https://api.github.com/repos/boto/boto3/assignees{/user}","branches_url":"https://api.github.com/repos/boto/boto3/branches{/branch}","tags_url":"https://api.github.com/repos/boto/boto3/tags","blobs_url":"https://api.github.com/repos/boto/boto3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boto/boto3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boto/boto3/git/refs{/sha}","trees_url":"https://api.github.com/repos/boto/boto3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boto/boto3/statuses/{sha}","languages_url":"https://api.github.com/repos/boto/boto3/languages","stargazers_url":"https://api.github.com/repos/boto/boto3/stargazers","contributors_url":"https://api.github.com/repos/boto/boto3/contributors","subscribers_url":"https://api.github.com/repos/boto/boto3/subscribers","subscription_url":"https://api.github.com/repos/boto/boto3/subscription","commits_url":"https://api.github.com/repos/boto/boto3/commits{/sha}","git_commits_url":"https://api.github.com/repos/boto/boto3/git/commits{/sha}","comments_url":"https://api.github.com/repos/boto/boto3/comments{/number}","issue_comment_url":"https://api.github.com/repos/boto/boto3/issues/comments{/number}","contents_url":"https://api.github.com/repos/boto/boto3/contents/{+path}","compare_url":"https://api.github.com/repos/boto/boto3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boto/boto3/merges","archive_url":"https://api.github.com/repos/boto/boto3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boto/boto3/downloads","issues_url":"https://api.github.com/repos/boto/boto3/issues{/number}","pulls_url":"https://api.github.com/repos/boto/boto3/pulls{/number}","milestones_url":"https://api.github.com/repos/boto/boto3/milestones{/number}","notifications_url":"https://api.github.com/repos/boto/boto3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boto/boto3/labels{/name}","releases_url":"https://api.github.com/repos/boto/boto3/releases{/id}","deployments_url":"https://api.github.com/repos/boto/boto3/deployments","created_at":"2014-10-03T21:38:03Z","updated_at":"2016-07-20T21:01:33Z","pushed_at":"2016-07-20T22:00:00Z","git_url":"git://github.com/boto/boto3.git","ssh_url":"git@github.com:boto/boto3.git","clone_url":"https://github.com/boto/boto3.git","svn_url":"https://github.com/boto/boto3","homepage":"http://aws.amazon.com/sdk-for-python/","size":1316,"stargazers_count":1216,"watchers_count":1216,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":235,"mirror_url":null,"open_issues_count":107,"forks":235,"open_issues":107,"watchers":1216,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/boto/boto3/pulls/724"},"html":{"href":"https://github.com/boto/boto3/pull/724"},"issue":{"href":"https://api.github.com/repos/boto/boto3/issues/724"},"comments":{"href":"https://api.github.com/repos/boto/boto3/issues/724/comments"},"review_comments":{"href":"https://api.github.com/repos/boto/boto3/pulls/724/comments"},"review_comment":{"href":"https://api.github.com/repos/boto/boto3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/boto/boto3/pulls/724/commits"},"statuses":{"href":"https://api.github.com/repos/boto/boto3/statuses/4678021508c38eafd997c7d066be9a1189a67319"}}}}
{"actor":{"display_login":"kyleknap"}}