{"action":"created","comment":{"url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/comments/118129676","pull_request_review_id":39893685,"id":118129676,"diff_hunk":"@@ -0,0 +1,38 @@\n+#! /usr/bin/env python\n+\n+import xml.etree.cElementTree as ET\n+from datetime import datetime\n+import requests\n+from argparse import ArgumentParser\n+\n+\n+parser = ArgumentParser()\n+\n+parser.add_argument(\n+    '-url',\n+    help='URL for metadata download'\n+)\n+parser.add_argument(\n+    '-path',\n+    help='Path to current metadata xml file'\n+)\n+\n+args = parser.parse_args()\n+\n+tree = ET.ElementTree(file=args.path)\n+root = tree.getroot().attrib\n+validUntil = root['validUntil']\n+datetime_object = datetime.strptime(validUntil, '%Y-%m-%dT%H:%M:%SZ')\n+validUntil = datetime_object.date()\n+leftDays = (validUntil - datetime.today().date()).days\n+\n+if leftDays <= 1:\n+    try:\n+        r = requests.get(args.url, stream=True, verify=False)\n+    except requests.exceptions.RequestException as e:\n+        print 'Error: {0}'.format(e)\n+    if r.status_code == 200:\n+        with open('nswidhub-test-idp-new.xml', 'wb') as f:","path":"ckanext/saml2/admin/fresh_idp_metadata.py","position":35,"original_position":35,"commit_id":"cd9820dea94f935331345bf916dca1d963bf0861","original_commit_id":"cd9820dea94f935331345bf916dca1d963bf0861","user":{"login":"MrkGrgsn","id":3621881,"avatar_url":"https://avatars0.githubusercontent.com/u/3621881?v=3","gravatar_id":"","url":"https://api.github.com/users/MrkGrgsn","html_url":"https://github.com/MrkGrgsn","followers_url":"https://api.github.com/users/MrkGrgsn/followers","following_url":"https://api.github.com/users/MrkGrgsn/following{/other_user}","gists_url":"https://api.github.com/users/MrkGrgsn/gists{/gist_id}","starred_url":"https://api.github.com/users/MrkGrgsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrkGrgsn/subscriptions","organizations_url":"https://api.github.com/users/MrkGrgsn/orgs","repos_url":"https://api.github.com/users/MrkGrgsn/repos","events_url":"https://api.github.com/users/MrkGrgsn/events{/privacy}","received_events_url":"https://api.github.com/users/MrkGrgsn/received_events","type":"User","site_admin":false},"body":"Why is the filename hardcoded when the script takes a path argument? Path should point to the filename of the IdP metadata used by CKAN so should be able to read from and write to that location.","created_at":"2017-05-23T23:25:17Z","updated_at":"2017-05-23T23:56:48Z","html_url":"https://github.com/DataShades/ckanext-saml2/pull/67#discussion_r118129676","pull_request_url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/comments/118129676"},"html":{"href":"https://github.com/DataShades/ckanext-saml2/pull/67#discussion_r118129676"},"pull_request":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67","id":121989273,"html_url":"https://github.com/DataShades/ckanext-saml2/pull/67","diff_url":"https://github.com/DataShades/ckanext-saml2/pull/67.diff","patch_url":"https://github.com/DataShades/ckanext-saml2/pull/67.patch","issue_url":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/67","number":67,"state":"open","locked":false,"title":"SXFNSWXZAI-240 / IdP metadata is refreshed automatically before expiry","user":{"login":"wildcatzita","id":10920720,"avatar_url":"https://avatars1.githubusercontent.com/u/10920720?v=3","gravatar_id":"","url":"https://api.github.com/users/wildcatzita","html_url":"https://github.com/wildcatzita","followers_url":"https://api.github.com/users/wildcatzita/followers","following_url":"https://api.github.com/users/wildcatzita/following{/other_user}","gists_url":"https://api.github.com/users/wildcatzita/gists{/gist_id}","starred_url":"https://api.github.com/users/wildcatzita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildcatzita/subscriptions","organizations_url":"https://api.github.com/users/wildcatzita/orgs","repos_url":"https://api.github.com/users/wildcatzita/repos","events_url":"https://api.github.com/users/wildcatzita/events{/privacy}","received_events_url":"https://api.github.com/users/wildcatzita/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-05-23T12:49:01Z","updated_at":"2017-05-23T23:56:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0937fff9381ce8bda4fd1f9d916130e60ea98684","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67/commits","review_comments_url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67/comments","review_comment_url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/67/comments","statuses_url":"https://api.github.com/repos/DataShades/ckanext-saml2/statuses/cd9820dea94f935331345bf916dca1d963bf0861","head":{"label":"wildcatzita:SXFNSWXZAI-240","ref":"SXFNSWXZAI-240","sha":"cd9820dea94f935331345bf916dca1d963bf0861","user":{"login":"wildcatzita","id":10920720,"avatar_url":"https://avatars1.githubusercontent.com/u/10920720?v=3","gravatar_id":"","url":"https://api.github.com/users/wildcatzita","html_url":"https://github.com/wildcatzita","followers_url":"https://api.github.com/users/wildcatzita/followers","following_url":"https://api.github.com/users/wildcatzita/following{/other_user}","gists_url":"https://api.github.com/users/wildcatzita/gists{/gist_id}","starred_url":"https://api.github.com/users/wildcatzita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildcatzita/subscriptions","organizations_url":"https://api.github.com/users/wildcatzita/orgs","repos_url":"https://api.github.com/users/wildcatzita/repos","events_url":"https://api.github.com/users/wildcatzita/events{/privacy}","received_events_url":"https://api.github.com/users/wildcatzita/received_events","type":"User","site_admin":false},"repo":{"id":83769548,"name":"ckanext-saml2","full_name":"wildcatzita/ckanext-saml2","owner":{"login":"wildcatzita","id":10920720,"avatar_url":"https://avatars1.githubusercontent.com/u/10920720?v=3","gravatar_id":"","url":"https://api.github.com/users/wildcatzita","html_url":"https://github.com/wildcatzita","followers_url":"https://api.github.com/users/wildcatzita/followers","following_url":"https://api.github.com/users/wildcatzita/following{/other_user}","gists_url":"https://api.github.com/users/wildcatzita/gists{/gist_id}","starred_url":"https://api.github.com/users/wildcatzita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildcatzita/subscriptions","organizations_url":"https://api.github.com/users/wildcatzita/orgs","repos_url":"https://api.github.com/users/wildcatzita/repos","events_url":"https://api.github.com/users/wildcatzita/events{/privacy}","received_events_url":"https://api.github.com/users/wildcatzita/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wildcatzita/ckanext-saml2","description":"SAML2 Authentication extension for CKAN","fork":true,"url":"https://api.github.com/repos/wildcatzita/ckanext-saml2","forks_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/forks","keys_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/teams","hooks_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/hooks","issue_events_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/issues/events{/number}","events_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/events","assignees_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/assignees{/user}","branches_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/branches{/branch}","tags_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/tags","blobs_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/git/refs{/sha}","trees_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/statuses/{sha}","languages_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/languages","stargazers_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/stargazers","contributors_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/contributors","subscribers_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/subscribers","subscription_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/subscription","commits_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/commits{/sha}","git_commits_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/git/commits{/sha}","comments_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/comments{/number}","issue_comment_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/issues/comments{/number}","contents_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/contents/{+path}","compare_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/merges","archive_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/downloads","issues_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/issues{/number}","pulls_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/pulls{/number}","milestones_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/milestones{/number}","notifications_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/labels{/name}","releases_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/releases{/id}","deployments_url":"https://api.github.com/repos/wildcatzita/ckanext-saml2/deployments","created_at":"2017-03-03T07:17:21Z","updated_at":"2017-03-03T07:17:22Z","pushed_at":"2017-05-23T15:59:52Z","git_url":"git://github.com/wildcatzita/ckanext-saml2.git","ssh_url":"git@github.com:wildcatzita/ckanext-saml2.git","clone_url":"https://github.com/wildcatzita/ckanext-saml2.git","svn_url":"https://github.com/wildcatzita/ckanext-saml2","homepage":"","size":183,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"link-master"}},"base":{"label":"DataShades:link-uat","ref":"link-uat","sha":"a6c36209489bdec3bbe22b17e9bff18d88c9c3bb","user":{"login":"DataShades","id":11066876,"avatar_url":"https://avatars2.githubusercontent.com/u/11066876?v=3","gravatar_id":"","url":"https://api.github.com/users/DataShades","html_url":"https://github.com/DataShades","followers_url":"https://api.github.com/users/DataShades/followers","following_url":"https://api.github.com/users/DataShades/following{/other_user}","gists_url":"https://api.github.com/users/DataShades/gists{/gist_id}","starred_url":"https://api.github.com/users/DataShades/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataShades/subscriptions","organizations_url":"https://api.github.com/users/DataShades/orgs","repos_url":"https://api.github.com/users/DataShades/repos","events_url":"https://api.github.com/users/DataShades/events{/privacy}","received_events_url":"https://api.github.com/users/DataShades/received_events","type":"Organization","site_admin":false},"repo":{"id":53625576,"name":"ckanext-saml2","full_name":"DataShades/ckanext-saml2","owner":{"login":"DataShades","id":11066876,"avatar_url":"https://avatars2.githubusercontent.com/u/11066876?v=3","gravatar_id":"","url":"https://api.github.com/users/DataShades","html_url":"https://github.com/DataShades","followers_url":"https://api.github.com/users/DataShades/followers","following_url":"https://api.github.com/users/DataShades/following{/other_user}","gists_url":"https://api.github.com/users/DataShades/gists{/gist_id}","starred_url":"https://api.github.com/users/DataShades/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataShades/subscriptions","organizations_url":"https://api.github.com/users/DataShades/orgs","repos_url":"https://api.github.com/users/DataShades/repos","events_url":"https://api.github.com/users/DataShades/events{/privacy}","received_events_url":"https://api.github.com/users/DataShades/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataShades/ckanext-saml2","description":"SAML2 Authentication extension for CKAN","fork":true,"url":"https://api.github.com/repos/DataShades/ckanext-saml2","forks_url":"https://api.github.com/repos/DataShades/ckanext-saml2/forks","keys_url":"https://api.github.com/repos/DataShades/ckanext-saml2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataShades/ckanext-saml2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataShades/ckanext-saml2/teams","hooks_url":"https://api.github.com/repos/DataShades/ckanext-saml2/hooks","issue_events_url":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/events{/number}","events_url":"https://api.github.com/repos/DataShades/ckanext-saml2/events","assignees_url":"https://api.github.com/repos/DataShades/ckanext-saml2/assignees{/user}","branches_url":"https://api.github.com/repos/DataShades/ckanext-saml2/branches{/branch}","tags_url":"https://api.github.com/repos/DataShades/ckanext-saml2/tags","blobs_url":"https://api.github.com/repos/DataShades/ckanext-saml2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataShades/ckanext-saml2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataShades/ckanext-saml2/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataShades/ckanext-saml2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataShades/ckanext-saml2/statuses/{sha}","languages_url":"https://api.github.com/repos/DataShades/ckanext-saml2/languages","stargazers_url":"https://api.github.com/repos/DataShades/ckanext-saml2/stargazers","contributors_url":"https://api.github.com/repos/DataShades/ckanext-saml2/contributors","subscribers_url":"https://api.github.com/repos/DataShades/ckanext-saml2/subscribers","subscription_url":"https://api.github.com/repos/DataShades/ckanext-saml2/subscription","commits_url":"https://api.github.com/repos/DataShades/ckanext-saml2/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataShades/ckanext-saml2/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataShades/ckanext-saml2/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataShades/ckanext-saml2/contents/{+path}","compare_url":"https://api.github.com/repos/DataShades/ckanext-saml2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataShades/ckanext-saml2/merges","archive_url":"https://api.github.com/repos/DataShades/ckanext-saml2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataShades/ckanext-saml2/downloads","issues_url":"https://api.github.com/repos/DataShades/ckanext-saml2/issues{/number}","pulls_url":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls{/number}","milestones_url":"https://api.github.com/repos/DataShades/ckanext-saml2/milestones{/number}","notifications_url":"https://api.github.com/repos/DataShades/ckanext-saml2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataShades/ckanext-saml2/labels{/name}","releases_url":"https://api.github.com/repos/DataShades/ckanext-saml2/releases{/id}","deployments_url":"https://api.github.com/repos/DataShades/ckanext-saml2/deployments","created_at":"2016-03-10T23:45:24Z","updated_at":"2017-04-18T14:53:03Z","pushed_at":"2017-05-23T21:26:29Z","git_url":"git://github.com/DataShades/ckanext-saml2.git","ssh_url":"git@github.com:DataShades/ckanext-saml2.git","clone_url":"https://github.com/DataShades/ckanext-saml2.git","svn_url":"https://github.com/DataShades/ckanext-saml2","homepage":"","size":173,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":2,"default_branch":"link-master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67"},"html":{"href":"https://github.com/DataShades/ckanext-saml2/pull/67"},"issue":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/67"},"comments":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/DataShades/ckanext-saml2/statuses/cd9820dea94f935331345bf916dca1d963bf0861"}}}}
{"actor":{"display_login":"MrkGrgsn"}}