{"action":"created","comment":{"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments/45650953","id":45650953,"diff_hunk":"@@ -10,3 +13,18 @@\n @require_http_methods(['GET'])\n def auth_error(request):\n     return JsonResponse({'error': 'Failed to authenticate request.'}, status=401)\n+\n+\n+@csrf_exempt\n+@authenticate()\n+@require_http_methods(['POST'])\n+def log_post_data(request):\n+    \"\"\"\n+    This method will help in logging POST data. This method is provided as an endpoint for the\n+    Mailgun Webhooks to log an event, so that we can monitor the various configured  events that are available\n+    (such as Delivered, Dropped, Bounces, etc)\n+    :param request:\n+    :return HttpResponse:\n+    \"\"\"\n+    logger.info(u'[MAILGUN EVENT] %s', json.dumps(request.POST, indent=4, sort_keys=True))\n+    return HttpResponse(\"Successfully logged post data\", status=200)","path":"mailgun/views.py","position":31,"original_position":31,"commit_id":"cf9490913099e628fdf7453b75cecfc366fadeaf","original_commit_id":"cf9490913099e628fdf7453b75cecfc366fadeaf","user":{"login":"rascalking","id":707505,"avatar_url":"https://avatars.githubusercontent.com/u/707505?v=3","gravatar_id":"","url":"https://api.github.com/users/rascalking","html_url":"https://github.com/rascalking","followers_url":"https://api.github.com/users/rascalking/followers","following_url":"https://api.github.com/users/rascalking/following{/other_user}","gists_url":"https://api.github.com/users/rascalking/gists{/gist_id}","starred_url":"https://api.github.com/users/rascalking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rascalking/subscriptions","organizations_url":"https://api.github.com/users/rascalking/orgs","repos_url":"https://api.github.com/users/rascalking/repos","events_url":"https://api.github.com/users/rascalking/events{/privacy}","received_events_url":"https://api.github.com/users/rascalking/received_events","type":"User","site_admin":false},"body":"Not that it matters, since Mailgun throws it away, but why an HttpResponse instead of the already-imported JsonResponse?","created_at":"2015-11-23T19:47:01Z","updated_at":"2015-11-23T19:47:01Z","html_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150#discussion_r45650953","pull_request_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150","_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments/45650953"},"html":{"href":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150#discussion_r45650953"},"pull_request":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150"}}},"pull_request":{"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150","id":51565693,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150","diff_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150.diff","patch_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150.patch","issue_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/150","number":150,"state":"open","locked":false,"title":"Task/sapnamysore/tlt 2131/logging for webhooks","user":{"login":"sapnamysore","id":1084105,"avatar_url":"https://avatars.githubusercontent.com/u/1084105?v=3","gravatar_id":"","url":"https://api.github.com/users/sapnamysore","html_url":"https://github.com/sapnamysore","followers_url":"https://api.github.com/users/sapnamysore/followers","following_url":"https://api.github.com/users/sapnamysore/following{/other_user}","gists_url":"https://api.github.com/users/sapnamysore/gists{/gist_id}","starred_url":"https://api.github.com/users/sapnamysore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sapnamysore/subscriptions","organizations_url":"https://api.github.com/users/sapnamysore/orgs","repos_url":"https://api.github.com/users/sapnamysore/repos","events_url":"https://api.github.com/users/sapnamysore/events{/privacy}","received_events_url":"https://api.github.com/users/sapnamysore/received_events","type":"User","site_admin":false},"body":"This PR contains changes creating an endpoint that would log  mailgun webhooks post  so that they can easily found in Splunk. More details in JIRA\r\nhttps://jira.huit.harvard.edu/browse/TLT-2131\r\n\r\nInitially I was logging certain keys, but also checked with Devops and they suggested logging the complete data as JSON with some identifiable  prefix. \r\n\r\nWebhooks are currently setup in Dev  for some events and I can see the logs in Splunk with the following query :\r\ntag=dev sourcetype=django_app source=\"/var/opt/tlt/logs/django-lti_emailer.log\" \"MAILGUN EVENT\"","created_at":"2015-11-23T19:07:53Z","updated_at":"2015-11-23T19:47:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fa495ee7f89fed21338d20e8112aa9731e97cac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150/commits","review_comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150/comments","review_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/150/comments","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/cf9490913099e628fdf7453b75cecfc366fadeaf","head":{"label":"Harvard-University-iCommons:task/sapnamysore/TLT-2131/logging_for_webhooks","ref":"task/sapnamysore/TLT-2131/logging_for_webhooks","sha":"cf9490913099e628fdf7453b75cecfc366fadeaf","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":33729277,"name":"lti_emailer","full_name":"Harvard-University-iCommons/lti_emailer","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer","description":"LTI tool that provides mailing-list capabilities for courses","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/releases{/id}","created_at":"2015-04-10T13:16:08Z","updated_at":"2015-10-19T13:58:43Z","pushed_at":"2015-11-23T19:07:54Z","git_url":"git://github.com/Harvard-University-iCommons/lti_emailer.git","ssh_url":"git@github.com:Harvard-University-iCommons/lti_emailer.git","clone_url":"https://github.com/Harvard-University-iCommons/lti_emailer.git","svn_url":"https://github.com/Harvard-University-iCommons/lti_emailer","homepage":"","size":623,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"Harvard-University-iCommons:develop","ref":"develop","sha":"add95c74f22d0b29f37c4e2f55aad0cc742c1624","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":33729277,"name":"lti_emailer","full_name":"Harvard-University-iCommons/lti_emailer","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer","description":"LTI tool that provides mailing-list capabilities for courses","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/releases{/id}","created_at":"2015-04-10T13:16:08Z","updated_at":"2015-10-19T13:58:43Z","pushed_at":"2015-11-23T19:07:54Z","git_url":"git://github.com/Harvard-University-iCommons/lti_emailer.git","ssh_url":"git@github.com:Harvard-University-iCommons/lti_emailer.git","clone_url":"https://github.com/Harvard-University-iCommons/lti_emailer.git","svn_url":"https://github.com/Harvard-University-iCommons/lti_emailer","homepage":"","size":623,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150"},"html":{"href":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/150"},"issue":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/150"},"comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/cf9490913099e628fdf7453b75cecfc366fadeaf"}}}}