{"action":"created","issue":{"url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/1","labels_url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/1/comments","events_url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/1/events","html_url":"https://github.com/RedditBotting/BLBForChomskydoz/pull/1","id":121525081,"number":1,"title":"Switch to OAuth","user":{"login":"Triplanetary","id":10700078,"avatar_url":"https://avatars.githubusercontent.com/u/10700078?v=3","gravatar_id":"","url":"https://api.github.com/users/Triplanetary","html_url":"https://github.com/Triplanetary","followers_url":"https://api.github.com/users/Triplanetary/followers","following_url":"https://api.github.com/users/Triplanetary/following{/other_user}","gists_url":"https://api.github.com/users/Triplanetary/gists{/gist_id}","starred_url":"https://api.github.com/users/Triplanetary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Triplanetary/subscriptions","organizations_url":"https://api.github.com/users/Triplanetary/orgs","repos_url":"https://api.github.com/users/Triplanetary/repos","events_url":"https://api.github.com/users/Triplanetary/events{/privacy}","received_events_url":"https://api.github.com/users/Triplanetary/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-10T16:27:59Z","updated_at":"2015-12-10T18:40:07Z","closed_at":"2015-12-10T18:34:24Z","pull_request":{"url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/pulls/1","html_url":"https://github.com/RedditBotting/BLBForChomskydoz/pull/1","diff_url":"https://github.com/RedditBotting/BLBForChomskydoz/pull/1.diff","patch_url":"https://github.com/RedditBotting/BLBForChomskydoz/pull/1.patch"},"body":"This is all it takes to use OAuth instead of user/pass login, along with a few minutes of setup on the part of whoever owns the reddit account the bot will use, so I see no reason to postpone. The site_name parameter will point PRAW to a block of a config file that lives on the machine running the script, which will contain the app ID, secret, and OAuth refresh token. With this information, all we need to do is call reddit.refresh_access_information(). This way we'll be future-proofed, and we can take advantage of reddit's allowance of one API call every second (instead of every two seconds for logged-in accounts) for OAuth users."},"comment":{"url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/comments/163712760","html_url":"https://github.com/RedditBotting/BLBForChomskydoz/pull/1#issuecomment-163712760","issue_url":"https://api.github.com/repos/RedditBotting/BLBForChomskydoz/issues/1","id":163712760,"user":{"login":"Triplanetary","id":10700078,"avatar_url":"https://avatars.githubusercontent.com/u/10700078?v=3","gravatar_id":"","url":"https://api.github.com/users/Triplanetary","html_url":"https://github.com/Triplanetary","followers_url":"https://api.github.com/users/Triplanetary/followers","following_url":"https://api.github.com/users/Triplanetary/following{/other_user}","gists_url":"https://api.github.com/users/Triplanetary/gists{/gist_id}","starred_url":"https://api.github.com/users/Triplanetary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Triplanetary/subscriptions","organizations_url":"https://api.github.com/users/Triplanetary/orgs","repos_url":"https://api.github.com/users/Triplanetary/repos","events_url":"https://api.github.com/users/Triplanetary/events{/privacy}","received_events_url":"https://api.github.com/users/Triplanetary/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T18:40:07Z","updated_at":"2015-12-10T18:40:07Z","body":"Also, it did occur to me after I'd already committed the PR that after the `if req.status_code == 200` block, there should really be an `else` block that *also* increments the counter. Requests doesn't throw exceptions for HTTP errors, it simply puts the error code in the request object's status_code attribute (as you see, obviously). The exception, for some reason, is timeouts, for which it throws `requests.exceptions.Timeout`."}}