{"action":"created","comment":{"url":"https://api.github.com/repos/Flexget/Flexget/pulls/comments/54354959","id":54354959,"diff_hunk":"@@ -80,10 +81,59 @@ def get_access_token(account, token=None, refresh=False, re_auth=False):\n                 data['refresh_token'] = acc.refresh_token\n                 data['grant_type'] = 'refresh_token'\n             elif token:\n+                # We are only in here if a pin was specified, so it's safe to use console instead of logging\n+                console('PIN authorization has been deprecated.')\n                 data['code'] = token\n                 data['grant_type'] = 'authorization_code'\n             else:\n-                raise plugin.PluginError('Account %s not found in db and no pin specified.' % account)\n+                log.debug('No pin specified for an unknown account %s. Attempting to authorize device.' % account)\n+                try:\n+                    data = {'client_id': CLIENT_ID}\n+                    r = requests.post(get_api_url('oauth/device/code'), data=data).json()\n+                    device_code = r['device_code']\n+                    user_code = r['user_code']\n+                    verification_url = r['verification_url']\n+                    expires_in = r['expires_in']\n+                    interval = r['interval']\n+\n+                    console('Please visit {0} and authorize Flexget. Your user code is {1}. Your code expires in '\n+                            '{2} minutes.'.format(verification_url, user_code, expires_in/60.0))\n+\n+                    log.debug('Polling for user authorization.')\n+                    data['code'] = device_code\n+                    data['client_secret'] = CLIENT_SECRET\n+                    end_time = time.time() + 5","path":"flexget/plugins/api_trakt.py","position":null,"original_position":34,"commit_id":"d99764931f85882cde222e5b02b4e8e753f8f54f","original_commit_id":"99926c4324023645202dd9ffae10b4671019c417","user":{"login":"cvium","id":675118,"avatar_url":"https://avatars.githubusercontent.com/u/675118?v=3","gravatar_id":"","url":"https://api.github.com/users/cvium","html_url":"https://github.com/cvium","followers_url":"https://api.github.com/users/cvium/followers","following_url":"https://api.github.com/users/cvium/following{/other_user}","gists_url":"https://api.github.com/users/cvium/gists{/gist_id}","starred_url":"https://api.github.com/users/cvium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvium/subscriptions","organizations_url":"https://api.github.com/users/cvium/orgs","repos_url":"https://api.github.com/users/cvium/repos","events_url":"https://api.github.com/users/cvium/events{/privacy}","received_events_url":"https://api.github.com/users/cvium/received_events","type":"User","site_admin":false},"body":"pff, haven't you ever had some leftover debugging code lying around? :P","created_at":"2016-02-28T19:39:42Z","updated_at":"2016-02-28T19:39:42Z","html_url":"https://github.com/Flexget/Flexget/pull/897#discussion_r54354959","pull_request_url":"https://api.github.com/repos/Flexget/Flexget/pulls/897","_links":{"self":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/comments/54354959"},"html":{"href":"https://github.com/Flexget/Flexget/pull/897#discussion_r54354959"},"pull_request":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/897"}}},"pull_request":{"url":"https://api.github.com/repos/Flexget/Flexget/pulls/897","id":61003262,"html_url":"https://github.com/Flexget/Flexget/pull/897","diff_url":"https://github.com/Flexget/Flexget/pull/897.diff","patch_url":"https://github.com/Flexget/Flexget/pull/897.patch","issue_url":"https://api.github.com/repos/Flexget/Flexget/issues/897","number":897,"state":"open","locked":false,"title":"[WIP] Added device authorization and deprecated PIN auth","user":{"login":"cvium","id":675118,"avatar_url":"https://avatars.githubusercontent.com/u/675118?v=3","gravatar_id":"","url":"https://api.github.com/users/cvium","html_url":"https://github.com/cvium","followers_url":"https://api.github.com/users/cvium/followers","following_url":"https://api.github.com/users/cvium/following{/other_user}","gists_url":"https://api.github.com/users/cvium/gists{/gist_id}","starred_url":"https://api.github.com/users/cvium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvium/subscriptions","organizations_url":"https://api.github.com/users/cvium/orgs","repos_url":"https://api.github.com/users/cvium/repos","events_url":"https://api.github.com/users/cvium/events{/privacy}","received_events_url":"https://api.github.com/users/cvium/received_events","type":"User","site_admin":false},"body":"http://docs.trakt.apiary.io/#reference/authentication-devices","created_at":"2016-02-28T19:32:57Z","updated_at":"2016-02-28T19:39:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b8d077851ff5d9ea4be4d583eca76874c4eb1b0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Flexget/Flexget/pulls/897/commits","review_comments_url":"https://api.github.com/repos/Flexget/Flexget/pulls/897/comments","review_comment_url":"https://api.github.com/repos/Flexget/Flexget/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Flexget/Flexget/issues/897/comments","statuses_url":"https://api.github.com/repos/Flexget/Flexget/statuses/d99764931f85882cde222e5b02b4e8e753f8f54f","head":{"label":"Flexget:auth_devices","ref":"auth_devices","sha":"d99764931f85882cde222e5b02b4e8e753f8f54f","user":{"login":"Flexget","id":682553,"avatar_url":"https://avatars.githubusercontent.com/u/682553?v=3","gravatar_id":"","url":"https://api.github.com/users/Flexget","html_url":"https://github.com/Flexget","followers_url":"https://api.github.com/users/Flexget/followers","following_url":"https://api.github.com/users/Flexget/following{/other_user}","gists_url":"https://api.github.com/users/Flexget/gists{/gist_id}","starred_url":"https://api.github.com/users/Flexget/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flexget/subscriptions","organizations_url":"https://api.github.com/users/Flexget/orgs","repos_url":"https://api.github.com/users/Flexget/repos","events_url":"https://api.github.com/users/Flexget/events{/privacy}","received_events_url":"https://api.github.com/users/Flexget/received_events","type":"Organization","site_admin":false},"repo":{"id":1512901,"name":"Flexget","full_name":"Flexget/Flexget","owner":{"login":"Flexget","id":682553,"avatar_url":"https://avatars.githubusercontent.com/u/682553?v=3","gravatar_id":"","url":"https://api.github.com/users/Flexget","html_url":"https://github.com/Flexget","followers_url":"https://api.github.com/users/Flexget/followers","following_url":"https://api.github.com/users/Flexget/following{/other_user}","gists_url":"https://api.github.com/users/Flexget/gists{/gist_id}","starred_url":"https://api.github.com/users/Flexget/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flexget/subscriptions","organizations_url":"https://api.github.com/users/Flexget/orgs","repos_url":"https://api.github.com/users/Flexget/repos","events_url":"https://api.github.com/users/Flexget/events{/privacy}","received_events_url":"https://api.github.com/users/Flexget/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Flexget/Flexget","description":"The official FlexGet repository","fork":false,"url":"https://api.github.com/repos/Flexget/Flexget","forks_url":"https://api.github.com/repos/Flexget/Flexget/forks","keys_url":"https://api.github.com/repos/Flexget/Flexget/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Flexget/Flexget/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Flexget/Flexget/teams","hooks_url":"https://api.github.com/repos/Flexget/Flexget/hooks","issue_events_url":"https://api.github.com/repos/Flexget/Flexget/issues/events{/number}","events_url":"https://api.github.com/repos/Flexget/Flexget/events","assignees_url":"https://api.github.com/repos/Flexget/Flexget/assignees{/user}","branches_url":"https://api.github.com/repos/Flexget/Flexget/branches{/branch}","tags_url":"https://api.github.com/repos/Flexget/Flexget/tags","blobs_url":"https://api.github.com/repos/Flexget/Flexget/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Flexget/Flexget/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Flexget/Flexget/git/refs{/sha}","trees_url":"https://api.github.com/repos/Flexget/Flexget/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Flexget/Flexget/statuses/{sha}","languages_url":"https://api.github.com/repos/Flexget/Flexget/languages","stargazers_url":"https://api.github.com/repos/Flexget/Flexget/stargazers","contributors_url":"https://api.github.com/repos/Flexget/Flexget/contributors","subscribers_url":"https://api.github.com/repos/Flexget/Flexget/subscribers","subscription_url":"https://api.github.com/repos/Flexget/Flexget/subscription","commits_url":"https://api.github.com/repos/Flexget/Flexget/commits{/sha}","git_commits_url":"https://api.github.com/repos/Flexget/Flexget/git/commits{/sha}","comments_url":"https://api.github.com/repos/Flexget/Flexget/comments{/number}","issue_comment_url":"https://api.github.com/repos/Flexget/Flexget/issues/comments{/number}","contents_url":"https://api.github.com/repos/Flexget/Flexget/contents/{+path}","compare_url":"https://api.github.com/repos/Flexget/Flexget/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Flexget/Flexget/merges","archive_url":"https://api.github.com/repos/Flexget/Flexget/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Flexget/Flexget/downloads","issues_url":"https://api.github.com/repos/Flexget/Flexget/issues{/number}","pulls_url":"https://api.github.com/repos/Flexget/Flexget/pulls{/number}","milestones_url":"https://api.github.com/repos/Flexget/Flexget/milestones{/number}","notifications_url":"https://api.github.com/repos/Flexget/Flexget/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Flexget/Flexget/labels{/name}","releases_url":"https://api.github.com/repos/Flexget/Flexget/releases{/id}","deployments_url":"https://api.github.com/repos/Flexget/Flexget/deployments","created_at":"2011-03-22T19:33:44Z","updated_at":"2016-02-27T23:50:01Z","pushed_at":"2016-02-28T19:38:59Z","git_url":"git://github.com/Flexget/Flexget.git","ssh_url":"git@github.com:Flexget/Flexget.git","clone_url":"https://github.com/Flexget/Flexget.git","svn_url":"https://github.com/Flexget/Flexget","homepage":"http://www.flexget.com","size":37200,"stargazers_count":437,"watchers_count":437,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":266,"mirror_url":null,"open_issues_count":57,"forks":266,"open_issues":57,"watchers":437,"default_branch":"develop"}},"base":{"label":"Flexget:develop","ref":"develop","sha":"cdbaff95e5b56136a3e55baefca9fe44e06122bd","user":{"login":"Flexget","id":682553,"avatar_url":"https://avatars.githubusercontent.com/u/682553?v=3","gravatar_id":"","url":"https://api.github.com/users/Flexget","html_url":"https://github.com/Flexget","followers_url":"https://api.github.com/users/Flexget/followers","following_url":"https://api.github.com/users/Flexget/following{/other_user}","gists_url":"https://api.github.com/users/Flexget/gists{/gist_id}","starred_url":"https://api.github.com/users/Flexget/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flexget/subscriptions","organizations_url":"https://api.github.com/users/Flexget/orgs","repos_url":"https://api.github.com/users/Flexget/repos","events_url":"https://api.github.com/users/Flexget/events{/privacy}","received_events_url":"https://api.github.com/users/Flexget/received_events","type":"Organization","site_admin":false},"repo":{"id":1512901,"name":"Flexget","full_name":"Flexget/Flexget","owner":{"login":"Flexget","id":682553,"avatar_url":"https://avatars.githubusercontent.com/u/682553?v=3","gravatar_id":"","url":"https://api.github.com/users/Flexget","html_url":"https://github.com/Flexget","followers_url":"https://api.github.com/users/Flexget/followers","following_url":"https://api.github.com/users/Flexget/following{/other_user}","gists_url":"https://api.github.com/users/Flexget/gists{/gist_id}","starred_url":"https://api.github.com/users/Flexget/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flexget/subscriptions","organizations_url":"https://api.github.com/users/Flexget/orgs","repos_url":"https://api.github.com/users/Flexget/repos","events_url":"https://api.github.com/users/Flexget/events{/privacy}","received_events_url":"https://api.github.com/users/Flexget/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Flexget/Flexget","description":"The official FlexGet repository","fork":false,"url":"https://api.github.com/repos/Flexget/Flexget","forks_url":"https://api.github.com/repos/Flexget/Flexget/forks","keys_url":"https://api.github.com/repos/Flexget/Flexget/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Flexget/Flexget/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Flexget/Flexget/teams","hooks_url":"https://api.github.com/repos/Flexget/Flexget/hooks","issue_events_url":"https://api.github.com/repos/Flexget/Flexget/issues/events{/number}","events_url":"https://api.github.com/repos/Flexget/Flexget/events","assignees_url":"https://api.github.com/repos/Flexget/Flexget/assignees{/user}","branches_url":"https://api.github.com/repos/Flexget/Flexget/branches{/branch}","tags_url":"https://api.github.com/repos/Flexget/Flexget/tags","blobs_url":"https://api.github.com/repos/Flexget/Flexget/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Flexget/Flexget/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Flexget/Flexget/git/refs{/sha}","trees_url":"https://api.github.com/repos/Flexget/Flexget/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Flexget/Flexget/statuses/{sha}","languages_url":"https://api.github.com/repos/Flexget/Flexget/languages","stargazers_url":"https://api.github.com/repos/Flexget/Flexget/stargazers","contributors_url":"https://api.github.com/repos/Flexget/Flexget/contributors","subscribers_url":"https://api.github.com/repos/Flexget/Flexget/subscribers","subscription_url":"https://api.github.com/repos/Flexget/Flexget/subscription","commits_url":"https://api.github.com/repos/Flexget/Flexget/commits{/sha}","git_commits_url":"https://api.github.com/repos/Flexget/Flexget/git/commits{/sha}","comments_url":"https://api.github.com/repos/Flexget/Flexget/comments{/number}","issue_comment_url":"https://api.github.com/repos/Flexget/Flexget/issues/comments{/number}","contents_url":"https://api.github.com/repos/Flexget/Flexget/contents/{+path}","compare_url":"https://api.github.com/repos/Flexget/Flexget/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Flexget/Flexget/merges","archive_url":"https://api.github.com/repos/Flexget/Flexget/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Flexget/Flexget/downloads","issues_url":"https://api.github.com/repos/Flexget/Flexget/issues{/number}","pulls_url":"https://api.github.com/repos/Flexget/Flexget/pulls{/number}","milestones_url":"https://api.github.com/repos/Flexget/Flexget/milestones{/number}","notifications_url":"https://api.github.com/repos/Flexget/Flexget/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Flexget/Flexget/labels{/name}","releases_url":"https://api.github.com/repos/Flexget/Flexget/releases{/id}","deployments_url":"https://api.github.com/repos/Flexget/Flexget/deployments","created_at":"2011-03-22T19:33:44Z","updated_at":"2016-02-27T23:50:01Z","pushed_at":"2016-02-28T19:38:59Z","git_url":"git://github.com/Flexget/Flexget.git","ssh_url":"git@github.com:Flexget/Flexget.git","clone_url":"https://github.com/Flexget/Flexget.git","svn_url":"https://github.com/Flexget/Flexget","homepage":"http://www.flexget.com","size":37200,"stargazers_count":437,"watchers_count":437,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":266,"mirror_url":null,"open_issues_count":57,"forks":266,"open_issues":57,"watchers":437,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/897"},"html":{"href":"https://github.com/Flexget/Flexget/pull/897"},"issue":{"href":"https://api.github.com/repos/Flexget/Flexget/issues/897"},"comments":{"href":"https://api.github.com/repos/Flexget/Flexget/issues/897/comments"},"review_comments":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/897/comments"},"review_comment":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Flexget/Flexget/pulls/897/commits"},"statuses":{"href":"https://api.github.com/repos/Flexget/Flexget/statuses/d99764931f85882cde222e5b02b4e8e753f8f54f"}}}}