{"action":"created","comment":{"url":"https://api.github.com/repos/edx/credentials/pulls/comments/203027742","pull_request_review_id":137835692,"id":203027742,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzAyNzc0Mg==","diff_hunk":"@@ -311,13 +314,52 @@ class ProgramRecordCsvView(View):\n     Returns a csv view of the Progam Record for a Learner from a username and program_uuid\n     \"\"\"\n \n+    class SegmentHttpResponse(HttpResponse):\n+        def __init__(self, *args, **kwargs):\n+            # Pop off the unneeded args that are sent to segment\n+            self.event = kwargs.pop('event')\n+            self.properties = kwargs.pop('properties')\n+            self.context = kwargs.pop('context')\n+            self.anonymous_id = kwargs.pop('anonymous_id')\n+            self.segment_client = kwargs.pop('segment_client')\n+            super(ProgramRecordCsvView.SegmentHttpResponse, self).__init__(*args, **kwargs)\n+\n+        def close(self):\n+            self.segment_client.track(\n+                self.anonymous_id,\n+                event=self.event,\n+                properties=self.properties,\n+                context=self.context\n+            )\n+            super(HttpResponse, self).close()\n+\n     def get(self, request, *args, **kwargs):\n         if not waffle.flag_is_active(request, WAFFLE_FLAG_RECORDS):\n             raise http.Http404()\n+\n+        site_configuration = request.site.siteconfiguration\n+        segment_client = SegmentClient(write_key=site_configuration.segment_key)\n+\n         program_cert_record = get_object_or_404(ProgramCertRecord, uuid=kwargs.get('uuid'))\n         program_certificate = get_object_or_404(ProgramCertificate, id=program_cert_record.certificate_id)\n         record = get_record_data(program_cert_record.user, program_certificate.program_uuid, request.site)\n \n+        segment_client.track(request.COOKIES['ajs_anonymous_id'],","path":"credentials/apps/records/views.py","position":49,"original_position":49,"commit_id":"3376db001908950e86085b3aaabb6a09adfbd62a","original_commit_id":"3376db001908950e86085b3aaabb6a09adfbd62a","user":{"login":"mikix","id":1196901,"node_id":"MDQ6VXNlcjExOTY5MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/1196901?v=4","gravatar_id":"","url":"https://api.github.com/users/mikix","html_url":"https://github.com/mikix","followers_url":"https://api.github.com/users/mikix/followers","following_url":"https://api.github.com/users/mikix/following{/other_user}","gists_url":"https://api.github.com/users/mikix/gists{/gist_id}","starred_url":"https://api.github.com/users/mikix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikix/subscriptions","organizations_url":"https://api.github.com/users/mikix/orgs","repos_url":"https://api.github.com/users/mikix/repos","events_url":"https://api.github.com/users/mikix/events{/privacy}","received_events_url":"https://api.github.com/users/mikix/received_events","type":"User","site_admin":false},"body":"Aw, that's a friendly design. Nice. Which also means there probably aren't any exceptions that get thrown.\r\n\r\n(How does one notice an error?)","created_at":"2018-07-17T13:46:58Z","updated_at":"2018-07-17T13:46:59Z","html_url":"https://github.com/edx/credentials/pull/466#discussion_r203027742","pull_request_url":"https://api.github.com/repos/edx/credentials/pulls/466","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/edx/credentials/pulls/comments/203027742"},"html":{"href":"https://github.com/edx/credentials/pull/466#discussion_r203027742"},"pull_request":{"href":"https://api.github.com/repos/edx/credentials/pulls/466"}},"in_reply_to_id":203013824},"pull_request":{"url":"https://api.github.com/repos/edx/credentials/pulls/466","id":201933065,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxOTMzMDY1","html_url":"https://github.com/edx/credentials/pull/466","diff_url":"https://github.com/edx/credentials/pull/466.diff","patch_url":"https://github.com/edx/credentials/pull/466.patch","issue_url":"https://api.github.com/repos/edx/credentials/issues/466","number":466,"state":"open","locked":false,"title":"WIP: LEARNER-5741: Adds in segment tracking for csv download","user":{"login":"jlajoie","id":1559107,"node_id":"MDQ6VXNlcjE1NTkxMDc=","avatar_url":"https://avatars3.githubusercontent.com/u/1559107?v=4","gravatar_id":"","url":"https://api.github.com/users/jlajoie","html_url":"https://github.com/jlajoie","followers_url":"https://api.github.com/users/jlajoie/followers","following_url":"https://api.github.com/users/jlajoie/following{/other_user}","gists_url":"https://api.github.com/users/jlajoie/gists{/gist_id}","starred_url":"https://api.github.com/users/jlajoie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlajoie/subscriptions","organizations_url":"https://api.github.com/users/jlajoie/orgs","repos_url":"https://api.github.com/users/jlajoie/repos","events_url":"https://api.github.com/users/jlajoie/events{/privacy}","received_events_url":"https://api.github.com/users/jlajoie/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-17T12:59:41Z","updated_at":"2018-07-17T13:46:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4cdccce8318a98c25a0e73fd8c156bb3af30dd54","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/credentials/pulls/466/commits","review_comments_url":"https://api.github.com/repos/edx/credentials/pulls/466/comments","review_comment_url":"https://api.github.com/repos/edx/credentials/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/credentials/issues/466/comments","statuses_url":"https://api.github.com/repos/edx/credentials/statuses/3376db001908950e86085b3aaabb6a09adfbd62a","head":{"label":"edx:jlajoie/LEARNER-5741","ref":"jlajoie/LEARNER-5741","sha":"3376db001908950e86085b3aaabb6a09adfbd62a","user":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":47830104,"node_id":"MDEwOlJlcG9zaXRvcnk0NzgzMDEwNA==","name":"credentials","full_name":"edx/credentials","owner":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/credentials","description":"Service hosting course and program certificates","fork":false,"url":"https://api.github.com/repos/edx/credentials","forks_url":"https://api.github.com/repos/edx/credentials/forks","keys_url":"https://api.github.com/repos/edx/credentials/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/credentials/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/credentials/teams","hooks_url":"https://api.github.com/repos/edx/credentials/hooks","issue_events_url":"https://api.github.com/repos/edx/credentials/issues/events{/number}","events_url":"https://api.github.com/repos/edx/credentials/events","assignees_url":"https://api.github.com/repos/edx/credentials/assignees{/user}","branches_url":"https://api.github.com/repos/edx/credentials/branches{/branch}","tags_url":"https://api.github.com/repos/edx/credentials/tags","blobs_url":"https://api.github.com/repos/edx/credentials/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/credentials/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/credentials/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/credentials/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/credentials/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/credentials/languages","stargazers_url":"https://api.github.com/repos/edx/credentials/stargazers","contributors_url":"https://api.github.com/repos/edx/credentials/contributors","subscribers_url":"https://api.github.com/repos/edx/credentials/subscribers","subscription_url":"https://api.github.com/repos/edx/credentials/subscription","commits_url":"https://api.github.com/repos/edx/credentials/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/credentials/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/credentials/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/credentials/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/credentials/contents/{+path}","compare_url":"https://api.github.com/repos/edx/credentials/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/credentials/merges","archive_url":"https://api.github.com/repos/edx/credentials/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/credentials/downloads","issues_url":"https://api.github.com/repos/edx/credentials/issues{/number}","pulls_url":"https://api.github.com/repos/edx/credentials/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/credentials/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/credentials/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/credentials/labels{/name}","releases_url":"https://api.github.com/repos/edx/credentials/releases{/id}","deployments_url":"https://api.github.com/repos/edx/credentials/deployments","created_at":"2015-12-11T14:09:03Z","updated_at":"2018-07-16T19:11:32Z","pushed_at":"2018-07-17T13:44:28Z","git_url":"git://github.com/edx/credentials.git","ssh_url":"git@github.com:edx/credentials.git","clone_url":"https://github.com/edx/credentials.git","svn_url":"https://github.com/edx/credentials","homepage":"","size":5281,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":7,"open_issues":12,"watchers":4,"default_branch":"master"}},"base":{"label":"edx:jlajoie/LEARNER-5513","ref":"jlajoie/LEARNER-5513","sha":"d622146f6a23c2bbeff06417065b2f5207ca87c3","user":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":47830104,"node_id":"MDEwOlJlcG9zaXRvcnk0NzgzMDEwNA==","name":"credentials","full_name":"edx/credentials","owner":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/credentials","description":"Service hosting course and program certificates","fork":false,"url":"https://api.github.com/repos/edx/credentials","forks_url":"https://api.github.com/repos/edx/credentials/forks","keys_url":"https://api.github.com/repos/edx/credentials/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/credentials/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/credentials/teams","hooks_url":"https://api.github.com/repos/edx/credentials/hooks","issue_events_url":"https://api.github.com/repos/edx/credentials/issues/events{/number}","events_url":"https://api.github.com/repos/edx/credentials/events","assignees_url":"https://api.github.com/repos/edx/credentials/assignees{/user}","branches_url":"https://api.github.com/repos/edx/credentials/branches{/branch}","tags_url":"https://api.github.com/repos/edx/credentials/tags","blobs_url":"https://api.github.com/repos/edx/credentials/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/credentials/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/credentials/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/credentials/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/credentials/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/credentials/languages","stargazers_url":"https://api.github.com/repos/edx/credentials/stargazers","contributors_url":"https://api.github.com/repos/edx/credentials/contributors","subscribers_url":"https://api.github.com/repos/edx/credentials/subscribers","subscription_url":"https://api.github.com/repos/edx/credentials/subscription","commits_url":"https://api.github.com/repos/edx/credentials/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/credentials/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/credentials/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/credentials/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/credentials/contents/{+path}","compare_url":"https://api.github.com/repos/edx/credentials/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/credentials/merges","archive_url":"https://api.github.com/repos/edx/credentials/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/credentials/downloads","issues_url":"https://api.github.com/repos/edx/credentials/issues{/number}","pulls_url":"https://api.github.com/repos/edx/credentials/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/credentials/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/credentials/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/credentials/labels{/name}","releases_url":"https://api.github.com/repos/edx/credentials/releases{/id}","deployments_url":"https://api.github.com/repos/edx/credentials/deployments","created_at":"2015-12-11T14:09:03Z","updated_at":"2018-07-16T19:11:32Z","pushed_at":"2018-07-17T13:44:28Z","git_url":"git://github.com/edx/credentials.git","ssh_url":"git@github.com:edx/credentials.git","clone_url":"https://github.com/edx/credentials.git","svn_url":"https://github.com/edx/credentials","homepage":"","size":5281,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":7,"open_issues":12,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/credentials/pulls/466"},"html":{"href":"https://github.com/edx/credentials/pull/466"},"issue":{"href":"https://api.github.com/repos/edx/credentials/issues/466"},"comments":{"href":"https://api.github.com/repos/edx/credentials/issues/466/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/credentials/pulls/466/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/credentials/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/credentials/pulls/466/commits"},"statuses":{"href":"https://api.github.com/repos/edx/credentials/statuses/3376db001908950e86085b3aaabb6a09adfbd62a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mikix"}}