|
|
@ -1,20 +1,18 @@
|
|
|
|
#!/usr/bin/env python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
This is to get a refresh token from a private script app created through Reddit
|
|
|
|
So I heard you want to use OAuth2? This is a helper tool that gets the
|
|
|
|
apps here: https://www.reddit.com/prefs/apps/
|
|
|
|
authenticaton code for you and fires it into praw.ini.
|
|
|
|
|
|
|
|
|
|
|
|
1. Create app at above URI, using the private script option
|
|
|
|
How to use:
|
|
|
|
2. Enter client_id and secret into praw.ini
|
|
|
|
- Visit: https://www.reddit.com/prefs/apps
|
|
|
|
3. Run this script
|
|
|
|
- Create new "script", under callback URL put http://127.0.0.1:65010
|
|
|
|
4. At the prompt copy the URL and open it in your browser. Allow access to your
|
|
|
|
- Open praw.ini
|
|
|
|
private app and it'll redirect you to a broken webpage.
|
|
|
|
- oauth_client_id = { The ID displayed under the icon thingy }
|
|
|
|
5. Copy the code printed into your console as the oauth_refresh_token and enter
|
|
|
|
- oauth_client_secret = { The secret }
|
|
|
|
t in praw.ini
|
|
|
|
- oauth_redirect_uri = http://127.0.0.1:65010
|
|
|
|
6. All future requests through praw will use praw.ini to login with OAuth2
|
|
|
|
- Run this script
|
|
|
|
|
|
|
|
- Your browser will open to a page on Reddit listing requested perms
|
|
|
|
Once client/secret/refresh are in praw.ini you only have to call
|
|
|
|
- Click permit
|
|
|
|
refresh_access_information() instead of get_authorize_url() ->
|
|
|
|
|
|
|
|
get_access_information().
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
import praw
|
|
|
|
import praw
|
|
|
|