{"action":"created","comment":{"url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/comments/81757147","pull_request_review_id":2712499,"id":81757147,"diff_hunk":"@@ -26,41 +26,44 @@ def __init__(self, base_url=None, verify_ssl=False, verify_codes=True):\n \n     @property\n     def is_connected(self):\n-        return self._cookies and 'PLAY_SESSION' in self._cookies\n-\n-    def connect(self, email=None, password=None):\n-        email = email or qubell_config['user']\n-        password = password or qubell_config['password']\n-        url = self.base_url + '/signIn'\n-        data = {\n-            'email': email,\n-            'password': password}\n+        return (self._cookies and 'PLAY_SESSION' in self._cookies) or self._jwt_auth\n \n-        with self._session as session:\n-            session.post(url=url, data=data, verify=self.verify_ssl)\n-            self._cookies = session.cookies\n+    def connect(self, email=None, password=None, token=None):\n+        token = token or qubell_config['token']\n+        if token:\n+            self._jwt_auth = HTTPBearerAuth(token)\n+        else:\n+            email = email or qubell_config['user']\n+            password = password or qubell_config['password']\n+            url = self.base_url + '/signIn'\n+            data = {\n+                'email': email,\n+                'password': password}\n \n-        if not self.is_connected:\n-            raise ApiUnauthorizedError(\"Authentication failed, please check settings\")\n+            with self._session as session:\n+                session.post(url=url, data=data, verify=self.verify_ssl)\n+                self._cookies = session.cookies\n \n-        self._auth = HTTPBasicAuth(email, password)\n+            if not self.is_connected:","path":"qubell/api/provider/router.py","position":60,"original_position":60,"commit_id":"a96e1e6bb23dc995d1c7e0f9a64cfe2cfd7a4ada","original_commit_id":"421727f077cfe9e46f395a501f10fbd5bace3e94","user":{"login":"storgashov","id":1454397,"avatar_url":"https://avatars.githubusercontent.com/u/1454397?v=3","gravatar_id":"","url":"https://api.github.com/users/storgashov","html_url":"https://github.com/storgashov","followers_url":"https://api.github.com/users/storgashov/followers","following_url":"https://api.github.com/users/storgashov/following{/other_user}","gists_url":"https://api.github.com/users/storgashov/gists{/gist_id}","starred_url":"https://api.github.com/users/storgashov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storgashov/subscriptions","organizations_url":"https://api.github.com/users/storgashov/orgs","repos_url":"https://api.github.com/users/storgashov/repos","events_url":"https://api.github.com/users/storgashov/events{/privacy}","received_events_url":"https://api.github.com/users/storgashov/received_events","type":"User","site_admin":false},"body":"It does actually by checking whether `self._jwt_auth` is defined","created_at":"2016-10-04T13:35:47Z","updated_at":"2016-10-04T13:35:47Z","html_url":"https://github.com/qubell/contrib-python-qubell-client/pull/259#discussion_r81757147","pull_request_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259","_links":{"self":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/comments/81757147"},"html":{"href":"https://github.com/qubell/contrib-python-qubell-client/pull/259#discussion_r81757147"},"pull_request":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259"}}},"pull_request":{"url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259","id":87764970,"html_url":"https://github.com/qubell/contrib-python-qubell-client/pull/259","diff_url":"https://github.com/qubell/contrib-python-qubell-client/pull/259.diff","patch_url":"https://github.com/qubell/contrib-python-qubell-client/pull/259.patch","issue_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/259","number":259,"state":"open","locked":false,"title":"Support for JWT based authentication","user":{"login":"storgashov","id":1454397,"avatar_url":"https://avatars.githubusercontent.com/u/1454397?v=3","gravatar_id":"","url":"https://api.github.com/users/storgashov","html_url":"https://github.com/storgashov","followers_url":"https://api.github.com/users/storgashov/followers","following_url":"https://api.github.com/users/storgashov/following{/other_user}","gists_url":"https://api.github.com/users/storgashov/gists{/gist_id}","starred_url":"https://api.github.com/users/storgashov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storgashov/subscriptions","organizations_url":"https://api.github.com/users/storgashov/orgs","repos_url":"https://api.github.com/users/storgashov/repos","events_url":"https://api.github.com/users/storgashov/events{/privacy}","received_events_url":"https://api.github.com/users/storgashov/received_events","type":"User","site_admin":false},"body":"New ``nomi`` commands and and authentication options:\r\n\r\n1. To generate a new session token from a refresh token:\r\n    ```\r\n    nomi token generate [--verbose] <YOUR_REFRESH_TOKEN>\r\n    ```\r\n\r\n2. To authenticate with the session token use the ``--token`` option:\r\n    ```\r\n    nomi --token <YOUR_SESSION_TOKEN> organization list\r\n    ```\r\n    OR alternatively set the ``QUBELL_TOKEN`` environment variable:\r\n    ```\r\n    export set QUBELL_TOKEN=<YOUR_SESSION_TOKEN>\r\n    nomi organization list\r\n    ```\r\n","created_at":"2016-10-03T18:19:49Z","updated_at":"2016-10-04T13:35:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5565e776035c75a6e060d8158479c704423ee5b2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259/commits","review_comments_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259/comments","review_comment_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/259/comments","statuses_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/statuses/a96e1e6bb23dc995d1c7e0f9a64cfe2cfd7a4ada","head":{"label":"storgashov:jwt-bearer","ref":"jwt-bearer","sha":"a96e1e6bb23dc995d1c7e0f9a64cfe2cfd7a4ada","user":{"login":"storgashov","id":1454397,"avatar_url":"https://avatars.githubusercontent.com/u/1454397?v=3","gravatar_id":"","url":"https://api.github.com/users/storgashov","html_url":"https://github.com/storgashov","followers_url":"https://api.github.com/users/storgashov/followers","following_url":"https://api.github.com/users/storgashov/following{/other_user}","gists_url":"https://api.github.com/users/storgashov/gists{/gist_id}","starred_url":"https://api.github.com/users/storgashov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storgashov/subscriptions","organizations_url":"https://api.github.com/users/storgashov/orgs","repos_url":"https://api.github.com/users/storgashov/repos","events_url":"https://api.github.com/users/storgashov/events{/privacy}","received_events_url":"https://api.github.com/users/storgashov/received_events","type":"User","site_admin":false},"repo":{"id":28480644,"name":"contrib-python-qubell-client","full_name":"storgashov/contrib-python-qubell-client","owner":{"login":"storgashov","id":1454397,"avatar_url":"https://avatars.githubusercontent.com/u/1454397?v=3","gravatar_id":"","url":"https://api.github.com/users/storgashov","html_url":"https://github.com/storgashov","followers_url":"https://api.github.com/users/storgashov/followers","following_url":"https://api.github.com/users/storgashov/following{/other_user}","gists_url":"https://api.github.com/users/storgashov/gists{/gist_id}","starred_url":"https://api.github.com/users/storgashov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storgashov/subscriptions","organizations_url":"https://api.github.com/users/storgashov/orgs","repos_url":"https://api.github.com/users/storgashov/repos","events_url":"https://api.github.com/users/storgashov/events{/privacy}","received_events_url":"https://api.github.com/users/storgashov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/storgashov/contrib-python-qubell-client","description":"","fork":true,"url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client","forks_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/forks","keys_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/teams","hooks_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/hooks","issue_events_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/issues/events{/number}","events_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/events","assignees_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/assignees{/user}","branches_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/branches{/branch}","tags_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/tags","blobs_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/statuses/{sha}","languages_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/languages","stargazers_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/stargazers","contributors_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/contributors","subscribers_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/subscribers","subscription_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/subscription","commits_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/contents/{+path}","compare_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/merges","archive_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/downloads","issues_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/issues{/number}","pulls_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/pulls{/number}","milestones_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/milestones{/number}","notifications_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/labels{/name}","releases_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/releases{/id}","deployments_url":"https://api.github.com/repos/storgashov/contrib-python-qubell-client/deployments","created_at":"2014-12-25T12:04:16Z","updated_at":"2016-06-06T11:38:15Z","pushed_at":"2016-10-04T13:25:14Z","git_url":"git://github.com/storgashov/contrib-python-qubell-client.git","ssh_url":"git@github.com:storgashov/contrib-python-qubell-client.git","clone_url":"https://github.com/storgashov/contrib-python-qubell-client.git","svn_url":"https://github.com/storgashov/contrib-python-qubell-client","homepage":null,"size":1113,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"master"}},"base":{"label":"qubell:develop","ref":"develop","sha":"25536e412d3bf6b4c6de9fed9272a2a529e208e5","user":{"login":"qubell","id":1406150,"avatar_url":"https://avatars.githubusercontent.com/u/1406150?v=3","gravatar_id":"","url":"https://api.github.com/users/qubell","html_url":"https://github.com/qubell","followers_url":"https://api.github.com/users/qubell/followers","following_url":"https://api.github.com/users/qubell/following{/other_user}","gists_url":"https://api.github.com/users/qubell/gists{/gist_id}","starred_url":"https://api.github.com/users/qubell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qubell/subscriptions","organizations_url":"https://api.github.com/users/qubell/orgs","repos_url":"https://api.github.com/users/qubell/repos","events_url":"https://api.github.com/users/qubell/events{/privacy}","received_events_url":"https://api.github.com/users/qubell/received_events","type":"Organization","site_admin":false},"repo":{"id":13830473,"name":"contrib-python-qubell-client","full_name":"qubell/contrib-python-qubell-client","owner":{"login":"qubell","id":1406150,"avatar_url":"https://avatars.githubusercontent.com/u/1406150?v=3","gravatar_id":"","url":"https://api.github.com/users/qubell","html_url":"https://github.com/qubell","followers_url":"https://api.github.com/users/qubell/followers","following_url":"https://api.github.com/users/qubell/following{/other_user}","gists_url":"https://api.github.com/users/qubell/gists{/gist_id}","starred_url":"https://api.github.com/users/qubell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qubell/subscriptions","organizations_url":"https://api.github.com/users/qubell/orgs","repos_url":"https://api.github.com/users/qubell/repos","events_url":"https://api.github.com/users/qubell/events{/privacy}","received_events_url":"https://api.github.com/users/qubell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qubell/contrib-python-qubell-client","description":"","fork":false,"url":"https://api.github.com/repos/qubell/contrib-python-qubell-client","forks_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/forks","keys_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/teams","hooks_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/hooks","issue_events_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/events{/number}","events_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/events","assignees_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/assignees{/user}","branches_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/branches{/branch}","tags_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/tags","blobs_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/statuses/{sha}","languages_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/languages","stargazers_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/stargazers","contributors_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/contributors","subscribers_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/subscribers","subscription_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/subscription","commits_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/contents/{+path}","compare_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/merges","archive_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/downloads","issues_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues{/number}","pulls_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls{/number}","milestones_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/milestones{/number}","notifications_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/labels{/name}","releases_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/releases{/id}","deployments_url":"https://api.github.com/repos/qubell/contrib-python-qubell-client/deployments","created_at":"2013-10-24T11:41:05Z","updated_at":"2016-01-21T08:22:35Z","pushed_at":"2016-10-04T13:25:15Z","git_url":"git://github.com/qubell/contrib-python-qubell-client.git","ssh_url":"git@github.com:qubell/contrib-python-qubell-client.git","clone_url":"https://github.com/qubell/contrib-python-qubell-client.git","svn_url":"https://github.com/qubell/contrib-python-qubell-client","homepage":null,"size":1220,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":11,"forks":12,"open_issues":11,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259"},"html":{"href":"https://github.com/qubell/contrib-python-qubell-client/pull/259"},"issue":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/259"},"comments":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/issues/259/comments"},"review_comments":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259/comments"},"review_comment":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/pulls/259/commits"},"statuses":{"href":"https://api.github.com/repos/qubell/contrib-python-qubell-client/statuses/a96e1e6bb23dc995d1c7e0f9a64cfe2cfd7a4ada"}}}}
{"actor":{"display_login":"storgashov"}}