{"action":"created","comment":{"url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/comments/137576771","pull_request_review_id":61263890,"id":137576771,"diff_hunk":"@@ -0,0 +1,56 @@\n+import requests\n+\n+ITEM_TYPE_URL = 'https://api.planet.com/data/v1/item-types/'\n+ASSET_TYPE_URL = 'https://api.planet.com/data/v1/asset-types/'\n+\n+_item_types = None\n+_asset_types = None\n+\n+# Default values here are used as a fallback\n+# In case the API fails to respond or takes too long.\n+_default_item_types = [\n+    \"PSScene4Band\", \"PSScene3Band\", \"REScene\", \"SkySatScene\",\n+    \"REOrthoTile\", \"Sentinel2L1C\", \"PSOrthoTile\", \"Landsat8L1G\"]\n+\n+_default_asset_types = [\n+    \"analytic\", \"analytic_b1\", \"analytic_b10\", \"analytic_b11\", \"analytic_b12\",\n+    \"analytic_b2\", \"analytic_b3\", \"analytic_b4\", \"analytic_b5\", \"analytic_b6\",\n+    \"analytic_b7\", \"analytic_b8\", \"analytic_b8a\", \"analytic_b9\",\n+    \"analytic_bqa\", \"analytic_dn\", \"analytic_dn_xml\", \"analytic_ms\",\n+    \"analytic_xml\", \"basic_analytic\", \"basic_analytic_b1\",\n+    \"basic_analytic_b1_nitf\", \"basic_analytic_b2\", \"basic_analytic_b2_nitf\",\n+    \"basic_analytic_b3\", \"basic_analytic_b3_nitf\", \"basic_analytic_b4\",\n+    \"basic_analytic_b4_nitf\", \"basic_analytic_b5\", \"basic_analytic_b5_nitf\",\n+    \"basic_analytic_dn\", \"basic_analytic_dn_nitf\", \"basic_analytic_dn_rpc\",\n+    \"basic_analytic_dn_rpc_nitf\", \"basic_analytic_dn_xml\",\n+    \"basic_analytic_dn_xml_nitf\", \"basic_analytic_nitf\", \"basic_analytic_rpc\",\n+    \"basic_analytic_rpc_nitf\", \"basic_analytic_sci\", \"basic_analytic_xml\",\n+    \"basic_analytic_xml_nitf\", \"basic_panchromatic_dn\",\n+    \"basic_panchromatic_dn_rpc\", \"basic_udm\", \"browse\", \"metadata_aux\",\n+    \"metadata_txt\", \"udm\", \"visual\", \"visual_xml\"\n+]\n+\n+def _get_json_or_raise(url, timeout=0.7):\n+    resp = requests.get(url, timeout)","path":"planet/scripts/item_asset_types.py","position":null,"original_position":34,"commit_id":"2710060b10e815738e8c47e9e8144a6154b51262","original_commit_id":"be325bb1224970a8cb6ef69c080052a007377d8f","user":{"login":"rpaul80","id":12152,"avatar_url":"https://avatars3.githubusercontent.com/u/12152?v=4","gravatar_id":"","url":"https://api.github.com/users/rpaul80","html_url":"https://github.com/rpaul80","followers_url":"https://api.github.com/users/rpaul80/followers","following_url":"https://api.github.com/users/rpaul80/following{/other_user}","gists_url":"https://api.github.com/users/rpaul80/gists{/gist_id}","starred_url":"https://api.github.com/users/rpaul80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpaul80/subscriptions","organizations_url":"https://api.github.com/users/rpaul80/orgs","repos_url":"https://api.github.com/users/rpaul80/repos","events_url":"https://api.github.com/users/rpaul80/events{/privacy}","received_events_url":"https://api.github.com/users/rpaul80/received_events","type":"User","site_admin":false},"body":"Do we want to retry here ?","created_at":"2017-09-07T15:41:54Z","updated_at":"2017-09-07T15:41:54Z","html_url":"https://github.com/planetlabs/planet-client-python/pull/113#discussion_r137576771","pull_request_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/comments/137576771"},"html":{"href":"https://github.com/planetlabs/planet-client-python/pull/113#discussion_r137576771"},"pull_request":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113","id":139695892,"html_url":"https://github.com/planetlabs/planet-client-python/pull/113","diff_url":"https://github.com/planetlabs/planet-client-python/pull/113.diff","patch_url":"https://github.com/planetlabs/planet-client-python/pull/113.patch","issue_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/113","number":113,"state":"open","locked":false,"title":"Get lists of item & asset types from the server","user":{"login":"deleted","id":64391,"avatar_url":"https://avatars3.githubusercontent.com/u/64391?v=4","gravatar_id":"","url":"https://api.github.com/users/deleted","html_url":"https://github.com/deleted","followers_url":"https://api.github.com/users/deleted/followers","following_url":"https://api.github.com/users/deleted/following{/other_user}","gists_url":"https://api.github.com/users/deleted/gists{/gist_id}","starred_url":"https://api.github.com/users/deleted/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deleted/subscriptions","organizations_url":"https://api.github.com/users/deleted/orgs","repos_url":"https://api.github.com/users/deleted/repos","events_url":"https://api.github.com/users/deleted/events{/privacy}","received_events_url":"https://api.github.com/users/deleted/received_events","type":"User","site_admin":false},"body":"Pursuant to [PE-15836](https://hello.planet.com/jira/browse/PE-15836).\r\n\r\nHere's a naive approach, with minimal impact on existing option parsing code... Still doing client-side argument validation, but fetching valid type lists from the server.  It will fall back to the hard coded list if the server errors out or takes too long to respond.\r\n\r\nIt doesn't seem to add a huge amount of response time (percentagewise) to normal API requests, though each of these list endpoints, tested individually, seems to take about 200ms to respond.\r\n\r\nTests TK.","created_at":"2017-09-07T01:01:55Z","updated_at":"2017-09-07T15:41:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"729c022d96e0c4594106710c12d1c8b43b65f09c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"cp16net","id":533503,"avatar_url":"https://avatars2.githubusercontent.com/u/533503?v=4","gravatar_id":"","url":"https://api.github.com/users/cp16net","html_url":"https://github.com/cp16net","followers_url":"https://api.github.com/users/cp16net/followers","following_url":"https://api.github.com/users/cp16net/following{/other_user}","gists_url":"https://api.github.com/users/cp16net/gists{/gist_id}","starred_url":"https://api.github.com/users/cp16net/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cp16net/subscriptions","organizations_url":"https://api.github.com/users/cp16net/orgs","repos_url":"https://api.github.com/users/cp16net/repos","events_url":"https://api.github.com/users/cp16net/events{/privacy}","received_events_url":"https://api.github.com/users/cp16net/received_events","type":"User","site_admin":false},{"login":"ischneider","id":794512,"avatar_url":"https://avatars1.githubusercontent.com/u/794512?v=4","gravatar_id":"","url":"https://api.github.com/users/ischneider","html_url":"https://github.com/ischneider","followers_url":"https://api.github.com/users/ischneider/followers","following_url":"https://api.github.com/users/ischneider/following{/other_user}","gists_url":"https://api.github.com/users/ischneider/gists{/gist_id}","starred_url":"https://api.github.com/users/ischneider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ischneider/subscriptions","organizations_url":"https://api.github.com/users/ischneider/orgs","repos_url":"https://api.github.com/users/ischneider/repos","events_url":"https://api.github.com/users/ischneider/events{/privacy}","received_events_url":"https://api.github.com/users/ischneider/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113/commits","review_comments_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113/comments","review_comment_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/113/comments","statuses_url":"https://api.github.com/repos/planetlabs/planet-client-python/statuses/2710060b10e815738e8c47e9e8144a6154b51262","head":{"label":"planetlabs:autotypes","ref":"autotypes","sha":"2710060b10e815738e8c47e9e8144a6154b51262","user":{"login":"planetlabs","id":5247016,"avatar_url":"https://avatars0.githubusercontent.com/u/5247016?v=4","gravatar_id":"","url":"https://api.github.com/users/planetlabs","html_url":"https://github.com/planetlabs","followers_url":"https://api.github.com/users/planetlabs/followers","following_url":"https://api.github.com/users/planetlabs/following{/other_user}","gists_url":"https://api.github.com/users/planetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/planetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planetlabs/subscriptions","organizations_url":"https://api.github.com/users/planetlabs/orgs","repos_url":"https://api.github.com/users/planetlabs/repos","events_url":"https://api.github.com/users/planetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/planetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":37222273,"name":"planet-client-python","full_name":"planetlabs/planet-client-python","owner":{"login":"planetlabs","id":5247016,"avatar_url":"https://avatars0.githubusercontent.com/u/5247016?v=4","gravatar_id":"","url":"https://api.github.com/users/planetlabs","html_url":"https://github.com/planetlabs","followers_url":"https://api.github.com/users/planetlabs/followers","following_url":"https://api.github.com/users/planetlabs/following{/other_user}","gists_url":"https://api.github.com/users/planetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/planetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planetlabs/subscriptions","organizations_url":"https://api.github.com/users/planetlabs/orgs","repos_url":"https://api.github.com/users/planetlabs/repos","events_url":"https://api.github.com/users/planetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/planetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/planetlabs/planet-client-python","description":"Python client for Planet's API ","fork":false,"url":"https://api.github.com/repos/planetlabs/planet-client-python","forks_url":"https://api.github.com/repos/planetlabs/planet-client-python/forks","keys_url":"https://api.github.com/repos/planetlabs/planet-client-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/planetlabs/planet-client-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/planetlabs/planet-client-python/teams","hooks_url":"https://api.github.com/repos/planetlabs/planet-client-python/hooks","issue_events_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/events{/number}","events_url":"https://api.github.com/repos/planetlabs/planet-client-python/events","assignees_url":"https://api.github.com/repos/planetlabs/planet-client-python/assignees{/user}","branches_url":"https://api.github.com/repos/planetlabs/planet-client-python/branches{/branch}","tags_url":"https://api.github.com/repos/planetlabs/planet-client-python/tags","blobs_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/planetlabs/planet-client-python/statuses/{sha}","languages_url":"https://api.github.com/repos/planetlabs/planet-client-python/languages","stargazers_url":"https://api.github.com/repos/planetlabs/planet-client-python/stargazers","contributors_url":"https://api.github.com/repos/planetlabs/planet-client-python/contributors","subscribers_url":"https://api.github.com/repos/planetlabs/planet-client-python/subscribers","subscription_url":"https://api.github.com/repos/planetlabs/planet-client-python/subscription","commits_url":"https://api.github.com/repos/planetlabs/planet-client-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/planetlabs/planet-client-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/planetlabs/planet-client-python/contents/{+path}","compare_url":"https://api.github.com/repos/planetlabs/planet-client-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/planetlabs/planet-client-python/merges","archive_url":"https://api.github.com/repos/planetlabs/planet-client-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/planetlabs/planet-client-python/downloads","issues_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues{/number}","pulls_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls{/number}","milestones_url":"https://api.github.com/repos/planetlabs/planet-client-python/milestones{/number}","notifications_url":"https://api.github.com/repos/planetlabs/planet-client-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/planetlabs/planet-client-python/labels{/name}","releases_url":"https://api.github.com/repos/planetlabs/planet-client-python/releases{/id}","deployments_url":"https://api.github.com/repos/planetlabs/planet-client-python/deployments","created_at":"2015-06-10T20:58:37Z","updated_at":"2017-08-21T12:55:26Z","pushed_at":"2017-09-07T01:54:29Z","git_url":"git://github.com/planetlabs/planet-client-python.git","ssh_url":"git@github.com:planetlabs/planet-client-python.git","clone_url":"https://github.com/planetlabs/planet-client-python.git","svn_url":"https://github.com/planetlabs/planet-client-python","homepage":"","size":733,"stargazers_count":50,"watchers_count":50,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":27,"forks":18,"open_issues":27,"watchers":50,"default_branch":"master"}},"base":{"label":"planetlabs:master","ref":"master","sha":"52077707fea544477853d73f84d27e42bd4fdf00","user":{"login":"planetlabs","id":5247016,"avatar_url":"https://avatars0.githubusercontent.com/u/5247016?v=4","gravatar_id":"","url":"https://api.github.com/users/planetlabs","html_url":"https://github.com/planetlabs","followers_url":"https://api.github.com/users/planetlabs/followers","following_url":"https://api.github.com/users/planetlabs/following{/other_user}","gists_url":"https://api.github.com/users/planetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/planetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planetlabs/subscriptions","organizations_url":"https://api.github.com/users/planetlabs/orgs","repos_url":"https://api.github.com/users/planetlabs/repos","events_url":"https://api.github.com/users/planetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/planetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":37222273,"name":"planet-client-python","full_name":"planetlabs/planet-client-python","owner":{"login":"planetlabs","id":5247016,"avatar_url":"https://avatars0.githubusercontent.com/u/5247016?v=4","gravatar_id":"","url":"https://api.github.com/users/planetlabs","html_url":"https://github.com/planetlabs","followers_url":"https://api.github.com/users/planetlabs/followers","following_url":"https://api.github.com/users/planetlabs/following{/other_user}","gists_url":"https://api.github.com/users/planetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/planetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planetlabs/subscriptions","organizations_url":"https://api.github.com/users/planetlabs/orgs","repos_url":"https://api.github.com/users/planetlabs/repos","events_url":"https://api.github.com/users/planetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/planetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/planetlabs/planet-client-python","description":"Python client for Planet's API ","fork":false,"url":"https://api.github.com/repos/planetlabs/planet-client-python","forks_url":"https://api.github.com/repos/planetlabs/planet-client-python/forks","keys_url":"https://api.github.com/repos/planetlabs/planet-client-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/planetlabs/planet-client-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/planetlabs/planet-client-python/teams","hooks_url":"https://api.github.com/repos/planetlabs/planet-client-python/hooks","issue_events_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/events{/number}","events_url":"https://api.github.com/repos/planetlabs/planet-client-python/events","assignees_url":"https://api.github.com/repos/planetlabs/planet-client-python/assignees{/user}","branches_url":"https://api.github.com/repos/planetlabs/planet-client-python/branches{/branch}","tags_url":"https://api.github.com/repos/planetlabs/planet-client-python/tags","blobs_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/planetlabs/planet-client-python/statuses/{sha}","languages_url":"https://api.github.com/repos/planetlabs/planet-client-python/languages","stargazers_url":"https://api.github.com/repos/planetlabs/planet-client-python/stargazers","contributors_url":"https://api.github.com/repos/planetlabs/planet-client-python/contributors","subscribers_url":"https://api.github.com/repos/planetlabs/planet-client-python/subscribers","subscription_url":"https://api.github.com/repos/planetlabs/planet-client-python/subscription","commits_url":"https://api.github.com/repos/planetlabs/planet-client-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/planetlabs/planet-client-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/planetlabs/planet-client-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/planetlabs/planet-client-python/contents/{+path}","compare_url":"https://api.github.com/repos/planetlabs/planet-client-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/planetlabs/planet-client-python/merges","archive_url":"https://api.github.com/repos/planetlabs/planet-client-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/planetlabs/planet-client-python/downloads","issues_url":"https://api.github.com/repos/planetlabs/planet-client-python/issues{/number}","pulls_url":"https://api.github.com/repos/planetlabs/planet-client-python/pulls{/number}","milestones_url":"https://api.github.com/repos/planetlabs/planet-client-python/milestones{/number}","notifications_url":"https://api.github.com/repos/planetlabs/planet-client-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/planetlabs/planet-client-python/labels{/name}","releases_url":"https://api.github.com/repos/planetlabs/planet-client-python/releases{/id}","deployments_url":"https://api.github.com/repos/planetlabs/planet-client-python/deployments","created_at":"2015-06-10T20:58:37Z","updated_at":"2017-08-21T12:55:26Z","pushed_at":"2017-09-07T01:54:29Z","git_url":"git://github.com/planetlabs/planet-client-python.git","ssh_url":"git@github.com:planetlabs/planet-client-python.git","clone_url":"https://github.com/planetlabs/planet-client-python.git","svn_url":"https://github.com/planetlabs/planet-client-python","homepage":"","size":733,"stargazers_count":50,"watchers_count":50,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":27,"forks":18,"open_issues":27,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113"},"html":{"href":"https://github.com/planetlabs/planet-client-python/pull/113"},"issue":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/issues/113"},"comments":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/planetlabs/planet-client-python/statuses/2710060b10e815738e8c47e9e8144a6154b51262"}},"author_association":"NONE"}}
{"actor":{"display_login":"rpaul80"}}