{"action":"created","comment":{"url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/comments/76023413","id":76023413,"diff_hunk":"@@ -77,19 +77,33 @@ def __init__(self, resp):\n \n \n class GetObjectResult(HeadObjectResult):\n-    def __init__(self, resp, progress_callback=None):\n+    def __init__(self, resp, progress_callback=None, crc_callback=None):\n         super(GetObjectResult, self).__init__(resp)\n-\n+        self.crc_callback = crc_callback\n+        \n         if progress_callback:\n             self.stream = make_progress_adapter(self.resp, progress_callback, self.content_length)\n         else:\n             self.stream = self.resp\n-\n+        \n+        self.crc = _hget(self.headers, 'x-oss-hash-crc64ecma', int)\n+        if self.crc_callback:\n+            self.stream = make_crc_adapter(self.stream)\n+            \n     def read(self, amt=None):\n         return self.stream.read(amt)\n \n     def __iter__(self):\n         return iter(self.stream)\n+    \n+    def get_client_crc(self):","path":"oss2/models.py","position":35,"original_position":35,"commit_id":"276a9f667a1654b50c47cc9dbba875cf76522cb2","original_commit_id":"276a9f667a1654b50c47cc9dbba875cf76522cb2","user":{"login":"yami","id":77224,"avatar_url":"https://avatars.githubusercontent.com/u/77224?v=3","gravatar_id":"","url":"https://api.github.com/users/yami","html_url":"https://github.com/yami","followers_url":"https://api.github.com/users/yami/followers","following_url":"https://api.github.com/users/yami/following{/other_user}","gists_url":"https://api.github.com/users/yami/gists{/gist_id}","starred_url":"https://api.github.com/users/yami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yami/subscriptions","organizations_url":"https://api.github.com/users/yami/orgs","repos_url":"https://api.github.com/users/yami/repos","events_url":"https://api.github.com/users/yami/events{/privacy}","received_events_url":"https://api.github.com/users/yami/received_events","type":"User","site_admin":false},"body":"命名：python 一般不会用 getter setter，直接叫做 client_crc即可，建议改名为calculated_crc？\r\n python的成员变量缺省就是public的，所以问题是 self.crc、self.crc_callback 这些你期望是public的吗？","created_at":"2016-08-24T09:25:09Z","updated_at":"2016-08-24T09:25:09Z","html_url":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41#discussion_r76023413","pull_request_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/comments/76023413"},"html":{"href":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41#discussion_r76023413"},"pull_request":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41","id":82318500,"html_url":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41","diff_url":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41.diff","patch_url":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41.patch","issue_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/41","number":41,"state":"open","locked":false,"title":"crc","user":{"login":"baiyubin","id":16008960,"avatar_url":"https://avatars.githubusercontent.com/u/16008960?v=3","gravatar_id":"","url":"https://api.github.com/users/baiyubin","html_url":"https://github.com/baiyubin","followers_url":"https://api.github.com/users/baiyubin/followers","following_url":"https://api.github.com/users/baiyubin/following{/other_user}","gists_url":"https://api.github.com/users/baiyubin/gists{/gist_id}","starred_url":"https://api.github.com/users/baiyubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baiyubin/subscriptions","organizations_url":"https://api.github.com/users/baiyubin/orgs","repos_url":"https://api.github.com/users/baiyubin/repos","events_url":"https://api.github.com/users/baiyubin/events{/privacy}","received_events_url":"https://api.github.com/users/baiyubin/received_events","type":"User","site_admin":false},"body":"支持CRC校验。\r\nCRC校验默认开启，用户可以关闭。\r\nCRC开启后，put_object/upload_part自动使用CRC校验；get_object返回服务端的CRC值，客户端数据读取完成后，会返回CRC，比较两个CRC的值，判断数据是否有效；append_object自动使用CRC校验，需要传入上次append的crc值。","created_at":"2016-08-23T07:53:25Z","updated_at":"2016-08-24T09:25:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9bbbe97f09ce24ec1dabbf384ed53b824ba908cc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41/commits","review_comments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41/comments","review_comment_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/41/comments","statuses_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/statuses/276a9f667a1654b50c47cc9dbba875cf76522cb2","head":{"label":"aliyun:crc-dev","ref":"crc-dev","sha":"276a9f667a1654b50c47cc9dbba875cf76522cb2","user":{"login":"aliyun","id":941070,"avatar_url":"https://avatars.githubusercontent.com/u/941070?v=3","gravatar_id":"","url":"https://api.github.com/users/aliyun","html_url":"https://github.com/aliyun","followers_url":"https://api.github.com/users/aliyun/followers","following_url":"https://api.github.com/users/aliyun/following{/other_user}","gists_url":"https://api.github.com/users/aliyun/gists{/gist_id}","starred_url":"https://api.github.com/users/aliyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliyun/subscriptions","organizations_url":"https://api.github.com/users/aliyun/orgs","repos_url":"https://api.github.com/users/aliyun/repos","events_url":"https://api.github.com/users/aliyun/events{/privacy}","received_events_url":"https://api.github.com/users/aliyun/received_events","type":"Organization","site_admin":false},"repo":{"id":47454460,"name":"aliyun-oss-python-sdk","full_name":"aliyun/aliyun-oss-python-sdk","owner":{"login":"aliyun","id":941070,"avatar_url":"https://avatars.githubusercontent.com/u/941070?v=3","gravatar_id":"","url":"https://api.github.com/users/aliyun","html_url":"https://github.com/aliyun","followers_url":"https://api.github.com/users/aliyun/followers","following_url":"https://api.github.com/users/aliyun/following{/other_user}","gists_url":"https://api.github.com/users/aliyun/gists{/gist_id}","starred_url":"https://api.github.com/users/aliyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliyun/subscriptions","organizations_url":"https://api.github.com/users/aliyun/orgs","repos_url":"https://api.github.com/users/aliyun/repos","events_url":"https://api.github.com/users/aliyun/events{/privacy}","received_events_url":"https://api.github.com/users/aliyun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aliyun/aliyun-oss-python-sdk","description":"Aliyun OSS SDK for Python","fork":false,"url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk","forks_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/forks","keys_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/teams","hooks_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/hooks","issue_events_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/events","assignees_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/tags","blobs_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/languages","stargazers_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/stargazers","contributors_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/contributors","subscribers_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/subscribers","subscription_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/subscription","commits_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/merges","archive_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/downloads","issues_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/labels{/name}","releases_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/deployments","created_at":"2015-12-05T12:09:57Z","updated_at":"2016-08-16T05:38:41Z","pushed_at":"2016-08-23T11:59:57Z","git_url":"git://github.com/aliyun/aliyun-oss-python-sdk.git","ssh_url":"git@github.com:aliyun/aliyun-oss-python-sdk.git","clone_url":"https://github.com/aliyun/aliyun-oss-python-sdk.git","svn_url":"https://github.com/aliyun/aliyun-oss-python-sdk","homepage":"","size":508,"stargazers_count":57,"watchers_count":57,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":5,"forks":19,"open_issues":5,"watchers":57,"default_branch":"master"}},"base":{"label":"aliyun:master","ref":"master","sha":"a8fff60b08d695d1121fb3e81a714821cfe8367c","user":{"login":"aliyun","id":941070,"avatar_url":"https://avatars.githubusercontent.com/u/941070?v=3","gravatar_id":"","url":"https://api.github.com/users/aliyun","html_url":"https://github.com/aliyun","followers_url":"https://api.github.com/users/aliyun/followers","following_url":"https://api.github.com/users/aliyun/following{/other_user}","gists_url":"https://api.github.com/users/aliyun/gists{/gist_id}","starred_url":"https://api.github.com/users/aliyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliyun/subscriptions","organizations_url":"https://api.github.com/users/aliyun/orgs","repos_url":"https://api.github.com/users/aliyun/repos","events_url":"https://api.github.com/users/aliyun/events{/privacy}","received_events_url":"https://api.github.com/users/aliyun/received_events","type":"Organization","site_admin":false},"repo":{"id":47454460,"name":"aliyun-oss-python-sdk","full_name":"aliyun/aliyun-oss-python-sdk","owner":{"login":"aliyun","id":941070,"avatar_url":"https://avatars.githubusercontent.com/u/941070?v=3","gravatar_id":"","url":"https://api.github.com/users/aliyun","html_url":"https://github.com/aliyun","followers_url":"https://api.github.com/users/aliyun/followers","following_url":"https://api.github.com/users/aliyun/following{/other_user}","gists_url":"https://api.github.com/users/aliyun/gists{/gist_id}","starred_url":"https://api.github.com/users/aliyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliyun/subscriptions","organizations_url":"https://api.github.com/users/aliyun/orgs","repos_url":"https://api.github.com/users/aliyun/repos","events_url":"https://api.github.com/users/aliyun/events{/privacy}","received_events_url":"https://api.github.com/users/aliyun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aliyun/aliyun-oss-python-sdk","description":"Aliyun OSS SDK for Python","fork":false,"url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk","forks_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/forks","keys_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/teams","hooks_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/hooks","issue_events_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/events","assignees_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/tags","blobs_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/languages","stargazers_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/stargazers","contributors_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/contributors","subscribers_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/subscribers","subscription_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/subscription","commits_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/merges","archive_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/downloads","issues_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/labels{/name}","releases_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/deployments","created_at":"2015-12-05T12:09:57Z","updated_at":"2016-08-16T05:38:41Z","pushed_at":"2016-08-23T11:59:57Z","git_url":"git://github.com/aliyun/aliyun-oss-python-sdk.git","ssh_url":"git@github.com:aliyun/aliyun-oss-python-sdk.git","clone_url":"https://github.com/aliyun/aliyun-oss-python-sdk.git","svn_url":"https://github.com/aliyun/aliyun-oss-python-sdk","homepage":"","size":508,"stargazers_count":57,"watchers_count":57,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":5,"forks":19,"open_issues":5,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41"},"html":{"href":"https://github.com/aliyun/aliyun-oss-python-sdk/pull/41"},"issue":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/41"},"comments":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/aliyun/aliyun-oss-python-sdk/statuses/276a9f667a1654b50c47cc9dbba875cf76522cb2"}}}}
{"actor":{"display_login":"yami"}}