{"action":"created","comment":{"url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/comments/285296165","pull_request_review_id":239144841,"id":285296165,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4NTI5NjE2NQ==","diff_hunk":"@@ -448,6 +449,55 @@ def delete_label(self, label_key):\n         else:\n             return False\n \n+    def add_labels(self, labels_dict):\n+        # type: (dict) -> bool\n+        \"\"\"Adds multiple labels to Resource.\n+\n+        Args:\n+            label_dict (dict): Labels (key/value pairs) to add to the Resource.\n+\n+        Returns:\n+            bool: True if the labels were added, False otherwise.\n+        \"\"\"\n+        headers = Headers(\n+            {\"content-type\": \"application/json\", \"accept\": \"application/json\"}\n+        )\n+\n+        labels_list = []\n+        for label_key, label_value in labels_dict.items():\n+            if label_key is not None and label_value is not None:\n+                label_key = label_key.value if isinstance(label_key, Enum) else label_key\n+                labels_list.append(\n+                    {\n+                        \"labelKey\": str(label_key),\n+                        \"labelValue\": str(label_value)\n+                    }\n+                )\n+\n+        data = {\n+            \"labels\": labels_list\n+        }\n+\n+        response_result = self.connection.api_call(\n+            \"PUT\",\n+            [\n+                \"datasets\",\n+                self.dataset_id,\n+                \"resources\",\n+                self.id,\n+                \"labels\",\n+            ],\n+            headers=headers,\n+            data=json.dumps(data),","path":"crux/models/resource.py","position":51,"original_position":51,"commit_id":"c8e1f4f7d698d54f86bbafb77c7138908a1e93c9","original_commit_id":"c8e1f4f7d698d54f86bbafb77c7138908a1e93c9","user":{"login":"antoncohen","id":784476,"node_id":"MDQ6VXNlcjc4NDQ3Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/784476?v=4","gravatar_id":"","url":"https://api.github.com/users/antoncohen","html_url":"https://github.com/antoncohen","followers_url":"https://api.github.com/users/antoncohen/followers","following_url":"https://api.github.com/users/antoncohen/following{/other_user}","gists_url":"https://api.github.com/users/antoncohen/gists{/gist_id}","starred_url":"https://api.github.com/users/antoncohen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoncohen/subscriptions","organizations_url":"https://api.github.com/users/antoncohen/orgs","repos_url":"https://api.github.com/users/antoncohen/repos","events_url":"https://api.github.com/users/antoncohen/events{/privacy}","received_events_url":"https://api.github.com/users/antoncohen/received_events","type":"User","site_admin":false},"body":"This could be `json=data`. I just did a quick search through the dataset.py and file.py files and `json=` seems to be more common.","created_at":"2019-05-17T21:36:29Z","updated_at":"2019-05-17T21:36:29Z","html_url":"https://github.com/cruxinformatics/crux-python/pull/32#discussion_r285296165","pull_request_url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/comments/285296165"},"html":{"href":"https://github.com/cruxinformatics/crux-python/pull/32#discussion_r285296165"},"pull_request":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32","id":278476788,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc4NDc2Nzg4","html_url":"https://github.com/cruxinformatics/crux-python/pull/32","diff_url":"https://github.com/cruxinformatics/crux-python/pull/32.diff","patch_url":"https://github.com/cruxinformatics/crux-python/pull/32.patch","issue_url":"https://api.github.com/repos/cruxinformatics/crux-python/issues/32","number":32,"state":"open","locked":false,"title":"Add multiple labels at once to a resource","user":{"login":"tlbjr","id":1733473,"node_id":"MDQ6VXNlcjE3MzM0NzM=","avatar_url":"https://avatars3.githubusercontent.com/u/1733473?v=4","gravatar_id":"","url":"https://api.github.com/users/tlbjr","html_url":"https://github.com/tlbjr","followers_url":"https://api.github.com/users/tlbjr/followers","following_url":"https://api.github.com/users/tlbjr/following{/other_user}","gists_url":"https://api.github.com/users/tlbjr/gists{/gist_id}","starred_url":"https://api.github.com/users/tlbjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlbjr/subscriptions","organizations_url":"https://api.github.com/users/tlbjr/orgs","repos_url":"https://api.github.com/users/tlbjr/repos","events_url":"https://api.github.com/users/tlbjr/events{/privacy}","received_events_url":"https://api.github.com/users/tlbjr/received_events","type":"User","site_admin":false},"body":"Added a new method `add_labels` to the `Resource` model for adding labels in batch.\r\nIncluded two unit tests, an integration test, and documentation updates.","created_at":"2019-05-14T00:07:06Z","updated_at":"2019-05-17T21:36:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58bcb32f9015fcad9704e0ec3752b888f7579bbf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32/commits","review_comments_url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32/comments","review_comment_url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cruxinformatics/crux-python/issues/32/comments","statuses_url":"https://api.github.com/repos/cruxinformatics/crux-python/statuses/c8e1f4f7d698d54f86bbafb77c7138908a1e93c9","head":{"label":"tlbjr:add_multiple_labels","ref":"add_multiple_labels","sha":"c8e1f4f7d698d54f86bbafb77c7138908a1e93c9","user":{"login":"tlbjr","id":1733473,"node_id":"MDQ6VXNlcjE3MzM0NzM=","avatar_url":"https://avatars3.githubusercontent.com/u/1733473?v=4","gravatar_id":"","url":"https://api.github.com/users/tlbjr","html_url":"https://github.com/tlbjr","followers_url":"https://api.github.com/users/tlbjr/followers","following_url":"https://api.github.com/users/tlbjr/following{/other_user}","gists_url":"https://api.github.com/users/tlbjr/gists{/gist_id}","starred_url":"https://api.github.com/users/tlbjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlbjr/subscriptions","organizations_url":"https://api.github.com/users/tlbjr/orgs","repos_url":"https://api.github.com/users/tlbjr/repos","events_url":"https://api.github.com/users/tlbjr/events{/privacy}","received_events_url":"https://api.github.com/users/tlbjr/received_events","type":"User","site_admin":false},"repo":{"id":185889232,"node_id":"MDEwOlJlcG9zaXRvcnkxODU4ODkyMzI=","name":"crux-python","full_name":"tlbjr/crux-python","private":false,"owner":{"login":"tlbjr","id":1733473,"node_id":"MDQ6VXNlcjE3MzM0NzM=","avatar_url":"https://avatars3.githubusercontent.com/u/1733473?v=4","gravatar_id":"","url":"https://api.github.com/users/tlbjr","html_url":"https://github.com/tlbjr","followers_url":"https://api.github.com/users/tlbjr/followers","following_url":"https://api.github.com/users/tlbjr/following{/other_user}","gists_url":"https://api.github.com/users/tlbjr/gists{/gist_id}","starred_url":"https://api.github.com/users/tlbjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlbjr/subscriptions","organizations_url":"https://api.github.com/users/tlbjr/orgs","repos_url":"https://api.github.com/users/tlbjr/repos","events_url":"https://api.github.com/users/tlbjr/events{/privacy}","received_events_url":"https://api.github.com/users/tlbjr/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tlbjr/crux-python","description":"Crux Python Client","fork":true,"url":"https://api.github.com/repos/tlbjr/crux-python","forks_url":"https://api.github.com/repos/tlbjr/crux-python/forks","keys_url":"https://api.github.com/repos/tlbjr/crux-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tlbjr/crux-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tlbjr/crux-python/teams","hooks_url":"https://api.github.com/repos/tlbjr/crux-python/hooks","issue_events_url":"https://api.github.com/repos/tlbjr/crux-python/issues/events{/number}","events_url":"https://api.github.com/repos/tlbjr/crux-python/events","assignees_url":"https://api.github.com/repos/tlbjr/crux-python/assignees{/user}","branches_url":"https://api.github.com/repos/tlbjr/crux-python/branches{/branch}","tags_url":"https://api.github.com/repos/tlbjr/crux-python/tags","blobs_url":"https://api.github.com/repos/tlbjr/crux-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tlbjr/crux-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tlbjr/crux-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/tlbjr/crux-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tlbjr/crux-python/statuses/{sha}","languages_url":"https://api.github.com/repos/tlbjr/crux-python/languages","stargazers_url":"https://api.github.com/repos/tlbjr/crux-python/stargazers","contributors_url":"https://api.github.com/repos/tlbjr/crux-python/contributors","subscribers_url":"https://api.github.com/repos/tlbjr/crux-python/subscribers","subscription_url":"https://api.github.com/repos/tlbjr/crux-python/subscription","commits_url":"https://api.github.com/repos/tlbjr/crux-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/tlbjr/crux-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/tlbjr/crux-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/tlbjr/crux-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/tlbjr/crux-python/contents/{+path}","compare_url":"https://api.github.com/repos/tlbjr/crux-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tlbjr/crux-python/merges","archive_url":"https://api.github.com/repos/tlbjr/crux-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tlbjr/crux-python/downloads","issues_url":"https://api.github.com/repos/tlbjr/crux-python/issues{/number}","pulls_url":"https://api.github.com/repos/tlbjr/crux-python/pulls{/number}","milestones_url":"https://api.github.com/repos/tlbjr/crux-python/milestones{/number}","notifications_url":"https://api.github.com/repos/tlbjr/crux-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tlbjr/crux-python/labels{/name}","releases_url":"https://api.github.com/repos/tlbjr/crux-python/releases{/id}","deployments_url":"https://api.github.com/repos/tlbjr/crux-python/deployments","created_at":"2019-05-10T00:12:53Z","updated_at":"2019-05-10T00:12:56Z","pushed_at":"2019-05-17T20:39:34Z","git_url":"git://github.com/tlbjr/crux-python.git","ssh_url":"git@github.com:tlbjr/crux-python.git","clone_url":"https://github.com/tlbjr/crux-python.git","svn_url":"https://github.com/tlbjr/crux-python","homepage":null,"size":190,"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,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cruxinformatics:master","ref":"master","sha":"ec798fc445522e42dd8ab953a70aec2b36154c68","user":{"login":"cruxinformatics","id":29620062,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NjIwMDYy","avatar_url":"https://avatars2.githubusercontent.com/u/29620062?v=4","gravatar_id":"","url":"https://api.github.com/users/cruxinformatics","html_url":"https://github.com/cruxinformatics","followers_url":"https://api.github.com/users/cruxinformatics/followers","following_url":"https://api.github.com/users/cruxinformatics/following{/other_user}","gists_url":"https://api.github.com/users/cruxinformatics/gists{/gist_id}","starred_url":"https://api.github.com/users/cruxinformatics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cruxinformatics/subscriptions","organizations_url":"https://api.github.com/users/cruxinformatics/orgs","repos_url":"https://api.github.com/users/cruxinformatics/repos","events_url":"https://api.github.com/users/cruxinformatics/events{/privacy}","received_events_url":"https://api.github.com/users/cruxinformatics/received_events","type":"Organization","site_admin":false},"repo":{"id":163707370,"node_id":"MDEwOlJlcG9zaXRvcnkxNjM3MDczNzA=","name":"crux-python","full_name":"cruxinformatics/crux-python","private":false,"owner":{"login":"cruxinformatics","id":29620062,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NjIwMDYy","avatar_url":"https://avatars2.githubusercontent.com/u/29620062?v=4","gravatar_id":"","url":"https://api.github.com/users/cruxinformatics","html_url":"https://github.com/cruxinformatics","followers_url":"https://api.github.com/users/cruxinformatics/followers","following_url":"https://api.github.com/users/cruxinformatics/following{/other_user}","gists_url":"https://api.github.com/users/cruxinformatics/gists{/gist_id}","starred_url":"https://api.github.com/users/cruxinformatics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cruxinformatics/subscriptions","organizations_url":"https://api.github.com/users/cruxinformatics/orgs","repos_url":"https://api.github.com/users/cruxinformatics/repos","events_url":"https://api.github.com/users/cruxinformatics/events{/privacy}","received_events_url":"https://api.github.com/users/cruxinformatics/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cruxinformatics/crux-python","description":"Crux Python Client","fork":false,"url":"https://api.github.com/repos/cruxinformatics/crux-python","forks_url":"https://api.github.com/repos/cruxinformatics/crux-python/forks","keys_url":"https://api.github.com/repos/cruxinformatics/crux-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cruxinformatics/crux-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cruxinformatics/crux-python/teams","hooks_url":"https://api.github.com/repos/cruxinformatics/crux-python/hooks","issue_events_url":"https://api.github.com/repos/cruxinformatics/crux-python/issues/events{/number}","events_url":"https://api.github.com/repos/cruxinformatics/crux-python/events","assignees_url":"https://api.github.com/repos/cruxinformatics/crux-python/assignees{/user}","branches_url":"https://api.github.com/repos/cruxinformatics/crux-python/branches{/branch}","tags_url":"https://api.github.com/repos/cruxinformatics/crux-python/tags","blobs_url":"https://api.github.com/repos/cruxinformatics/crux-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cruxinformatics/crux-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cruxinformatics/crux-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/cruxinformatics/crux-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cruxinformatics/crux-python/statuses/{sha}","languages_url":"https://api.github.com/repos/cruxinformatics/crux-python/languages","stargazers_url":"https://api.github.com/repos/cruxinformatics/crux-python/stargazers","contributors_url":"https://api.github.com/repos/cruxinformatics/crux-python/contributors","subscribers_url":"https://api.github.com/repos/cruxinformatics/crux-python/subscribers","subscription_url":"https://api.github.com/repos/cruxinformatics/crux-python/subscription","commits_url":"https://api.github.com/repos/cruxinformatics/crux-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/cruxinformatics/crux-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/cruxinformatics/crux-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/cruxinformatics/crux-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/cruxinformatics/crux-python/contents/{+path}","compare_url":"https://api.github.com/repos/cruxinformatics/crux-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cruxinformatics/crux-python/merges","archive_url":"https://api.github.com/repos/cruxinformatics/crux-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cruxinformatics/crux-python/downloads","issues_url":"https://api.github.com/repos/cruxinformatics/crux-python/issues{/number}","pulls_url":"https://api.github.com/repos/cruxinformatics/crux-python/pulls{/number}","milestones_url":"https://api.github.com/repos/cruxinformatics/crux-python/milestones{/number}","notifications_url":"https://api.github.com/repos/cruxinformatics/crux-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cruxinformatics/crux-python/labels{/name}","releases_url":"https://api.github.com/repos/cruxinformatics/crux-python/releases{/id}","deployments_url":"https://api.github.com/repos/cruxinformatics/crux-python/deployments","created_at":"2019-01-01T01:46:13Z","updated_at":"2019-05-01T21:00:12Z","pushed_at":"2019-05-17T20:39:35Z","git_url":"git://github.com/cruxinformatics/crux-python.git","ssh_url":"git@github.com:cruxinformatics/crux-python.git","clone_url":"https://github.com/cruxinformatics/crux-python.git","svn_url":"https://github.com/cruxinformatics/crux-python","homepage":null,"size":181,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32"},"html":{"href":"https://github.com/cruxinformatics/crux-python/pull/32"},"issue":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/issues/32"},"comments":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/cruxinformatics/crux-python/statuses/c8e1f4f7d698d54f86bbafb77c7138908a1e93c9"}},"author_association":"NONE"}}
{"actor":{"display_login":"antoncohen"}}