{"action":"created","issue":{"url":"https://api.github.com/repos/jsober/Reddit-API/issues/14","labels_url":"https://api.github.com/repos/jsober/Reddit-API/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/jsober/Reddit-API/issues/14/comments","events_url":"https://api.github.com/repos/jsober/Reddit-API/issues/14/events","html_url":"https://github.com/jsober/Reddit-API/pull/14","id":99004462,"number":14,"title":"Oauth Support","user":{"login":"earth-tone","id":12517389,"avatar_url":"https://avatars.githubusercontent.com/u/12517389?v=3","gravatar_id":"","url":"https://api.github.com/users/earth-tone","html_url":"https://github.com/earth-tone","followers_url":"https://api.github.com/users/earth-tone/followers","following_url":"https://api.github.com/users/earth-tone/following{/other_user}","gists_url":"https://api.github.com/users/earth-tone/gists{/gist_id}","starred_url":"https://api.github.com/users/earth-tone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earth-tone/subscriptions","organizations_url":"https://api.github.com/users/earth-tone/orgs","repos_url":"https://api.github.com/users/earth-tone/repos","events_url":"https://api.github.com/users/earth-tone/events{/privacy}","received_events_url":"https://api.github.com/users/earth-tone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-04T16:10:30Z","updated_at":"2015-08-06T01:58:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jsober/Reddit-API/pulls/14","html_url":"https://github.com/jsober/Reddit-API/pull/14","diff_url":"https://github.com/jsober/Reddit-API/pull/14.diff","patch_url":"https://github.com/jsober/Reddit-API/pull/14.patch"},"body":"So, this will likely look like a huge mess. The readme has a detailed explanation and is nicely formatted, so I won't retype it all here, I'll just summarize. When I have more time I may do a more detailed writeup. At the moment I just wanted to get this out there because of Reddit's new Oauth requirement that went into effect August 3rd.\r\n\r\n-I've updated Reddit::Client with Oauth support. There is now a get_token(client_id, secret, username, password) function. Tokens last for an hour and refresh automatically if your script runs continually for more than an hour. Instructions on registering a script are included.\r\n\r\n-Added get_subreddit_comments function, which get all the comments from a subreddit or multi. Reddit's new API maxes out at 100 results, so another function that only does a basic json request (no API) is planned, to hopefully be able to grab 500 at a time.\r\n\r\n-send_message function is still there from the last time\r\n\r\n-me() function updated to work with new API"},"comment":{"url":"https://api.github.com/repos/jsober/Reddit-API/issues/comments/128209577","html_url":"https://github.com/jsober/Reddit-API/pull/14#issuecomment-128209577","issue_url":"https://api.github.com/repos/jsober/Reddit-API/issues/14","id":128209577,"user":{"login":"earth-tone","id":12517389,"avatar_url":"https://avatars.githubusercontent.com/u/12517389?v=3","gravatar_id":"","url":"https://api.github.com/users/earth-tone","html_url":"https://github.com/earth-tone","followers_url":"https://api.github.com/users/earth-tone/followers","following_url":"https://api.github.com/users/earth-tone/following{/other_user}","gists_url":"https://api.github.com/users/earth-tone/gists{/gist_id}","starred_url":"https://api.github.com/users/earth-tone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earth-tone/subscriptions","organizations_url":"https://api.github.com/users/earth-tone/orgs","repos_url":"https://api.github.com/users/earth-tone/repos","events_url":"https://api.github.com/users/earth-tone/events{/privacy}","received_events_url":"https://api.github.com/users/earth-tone/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T01:58:47Z","updated_at":"2015-08-06T01:58:47Z","body":"I've been avoiding unit tests because I've never done them and don't know exactly what should be in them.\r\n\r\nI added a file called unit_tests, which has 7 tests of the new functions using Test::Simple. It basically just checks that each one works, it doesn't test all scenarios.\r\n\r\nI'm not expecting all of this code to get accepted soon (or ever); I kind of submitted it for completeness and so it wouldn't look like I was developing my own separate version of Reddit::Client or something. I'm not; I'm just adding the functions that I need. With the Oauth change, I had to decide whether to update my Python PRAW bots to work with it, or to move everything to perl and update Reddit::Client to do everything that PRAW does. I opted for the latter. Most of my scripts are in Perl anyway and it's a lot easier for me to write in Perl; the only reason I was using PRAW at all was because it had functions that Reddit::Client didn't.\r\n\r\nI'm still very actively working on it. I just now removed the login requirement from send_message() because Oauth no longer needs a traditional login and it was breaking things; your token is what your cookie would have been before. "}}