예제 #1
0
def bot_init():
    """
    Initialises the bot setting the refresh_token and the refresh_token through oauth
    """
    oauth_server = PrawOAuth2Server(REDDIT_CLIENT,
                                    settings.reddit_app_key,
                                    settings.reddit_app_secret,
                                    state=USER_AGENT,
                                    scopes=settings.scopes)
    oauth_server.start()
    tokens = oauth_server.get_access_codes()
    print tokens
    write_config(tokens)
예제 #2
0
#!/usr/bin/env python
import praw
from prawoauth2 import PrawOAuth2Server
from settings import settings

r = praw.Reddit(user_agent=settings['user-agent'])

oauthserver = PrawOAuth2Server(r,
                               settings['app_key'],
                               settings['app_secret'],
                               state=settings['user-agent'],
                               scopes=settings['scopes'])

oauthserver.start()

print(oauthserver.get_access_codes())
예제 #3
0
#!/usr/bin/env python

# this meant to be run once only, for a bot as recommended here -
# https://github.com/avinassh/prawoauth2
# taken from example here -
# https://github.com/avinassh/prawoauth2/blob/master/examples/halflife3-bot/onetime.py

import praw
from prawoauth2 import PrawOAuth2Server

from settings import user_agent, scopes, app_key, app_secret

reddit_client = praw.Reddit(user_agent=user_agent)
oauthserver = PrawOAuth2Server(reddit_client,
                               app_key=app_key,
                               app_secret=app_secret,
                               state=user_agent,
                               scopes=scopes)

# start the server, this will open default web browser
# asking you to authenticate
oauthserver.start()
print(oauthserver.get_access_codes())
예제 #4
0
import praw
from prawoauth2 import PrawOAuth2Server
from settings import USER_AGENT, scopes

r = praw.Reddit(USER_AGENT)

oauthserver = PrawOAuth2Server(r,
                               CLIENT_ID,
                               CLIENT_SECRET,
                               state=USER_AGENT,
                               scopes=scopes)
oauthserver.start()

tokens = oauthserver.get_access_codes()
print(tokens)
예제 #5
0
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 20 08:03:55 2015

@author: Sean.Titmarsh
"""

import praw
from prawoauth2 import PrawOAuth2Server

user_agent = 'OAuth token retrieval for /u/seantitmarsh'
reddit_client = praw.Reddit(user_agent=user_agent)
app_key = "Key"
app_secret = "Secret"
oauthserver = PrawOAuth2Server(reddit_client, app_key, app_secret,state=user_agent, scopes=['identity', 'edit', 'flair', 'history', 'modconfig', 'modflair', 'modlog', 'modposts', 'modwiki', 'mysubreddits', 'privatemessages', 'read', 'report', 'save', 'submit', 'subscribe', 'vote', 'wikiedit', 'wikiread'])

oauthserver.start()
tokens = oauthserver.get_access_codes()
print(tokens)

reddit_client.get_me()
예제 #6
0
#!/usr/bin/env python

# this meant to be run once only, for a bot as recommended here -
# https://github.com/avinassh/prawoauth2
# taken from example here -
# https://github.com/avinassh/prawoauth2/blob/master/examples/halflife3-bot/onetime.py

import praw
from prawoauth2 import PrawOAuth2Server

from steampowered_config import *

reddit_client = praw.Reddit(user_agent=USER_AGENT)
oauthserver = PrawOAuth2Server(reddit_client,
                               app_key=APPKEY,
                               app_secret=APPSECRET,
                               state=USER_AGENT,
                               scopes=SCOPES)

# start the server, this will open default web browser
# asking you to authenticate
oauthserver.start()
print(oauthserver.get_access_codes())
예제 #7
0
import praw
from prawoauth2 import PrawOAuth2Server
import os

from settings import SYACR_CLIENT_ID, SYACR_CLIENT_SECRET, UA, SCOPES

reddit_client = praw.Reddit(user_agent=UA)
oauthserver = PrawOAuth2Server(reddit_client,
                               app_key=SYACR_CLIENT_ID,
                               app_secret=SYACR_CLIENT_SECRET,
                               state=UA,
                               scopes=SCOPES)

oauthserver.start()
tokens = oauthserver.get_access_codes()
print(tokens)

print tokens['access_token']
print tokens['refresh_token']
예제 #8
0
import praw
from prawoauth2 import PrawOAuth2Server
from tokens import app_key, app_secret, scopes

user_agent = 'Drunken Prawler: teaching me computer stuff'
reddit_client = praw.Reddit(user_agent=user_agent)
oauthserver = PrawOAuth2Server(reddit_client,
                               app_key='MY_KEY',
                               app_secret='MY_SECRET_KEY',
                               state=user_agent,
                               scopes=scopes)
# start the server, this will open default web browser
# asking you to authenticate
oauthserver.start()
tokens = oauthserver.get_access_codes()
print(tokens)
예제 #9
0
#!/usr/bin/env python

# this meant to be run once only, for a bot as recommended here -
# https://github.com/avinassh/prawoauth2
# taken from example here -
# https://github.com/avinassh/prawoauth2/blob/master/examples/halflife3-bot/onetime.py

import praw
from prawoauth2 import PrawOAuth2Server

from settings import user_agent, scopes
from tokens import app_key, app_secret

REDDIT_CLIENT = praw.Reddit(user_agent=user_agent)
oauthserver = PrawOAuth2Server(REDDIT_CLIENT,
                               app_key=app_key,
                               app_secret=app_secret,
                               state=user_agent,
                               scopes=scopes)

# start the server, this will open default web browser
# asking you to authenticate
if __name__ == '__main__':
    oauthserver.start()
    print(oauthserver.get_access_codes())
예제 #10
0
    PASSWORD = Config.password
    USERAGENT = Config.useragent
    REDDITAPPID = Config.redditappid
    REDDITAPPSECRET = Config.redditappsecret
    REFRESHTOKEN = Config.refreshtoken
    SUBREDDITLIST = Config.get_formatted_subreddit_list()
except ImportError:
    pass

user_agent = 'Lewd/0.1'
reddit = praw.Reddit(user_agent=user_agent)
scopes = ['identity', 'read', 'submit', 'privatemessages']

oauthserver = PrawOAuth2Server(reddit,
                               'ETCyhisKnLla9w',
                               'jmYpEYiL85SSCBq-Gz47Zawhjto',
                               state=user_agent,
                               scopes=scopes)
oauthserver.start()
#reddit = praw.Reddit('explainbot', user_agent = 'web:xkcd-explain-bot:v0.1 (by /u/Lewd)')
#reddit = praw.Reddit(client_id=REDDITAPPID,
#                     client_secret=REDDITAPPSECRET,
#                     redirect_uri='http://127.0.0.1:65010/',
#                     user_agent=USERAGENT)
#reddit = praw.Reddit(client_id=REDDITAPPID, client_secret=REDDITAPPSECRET,
#                     password=PASSWORD, user_agent=USERAGENT,
#                     username=USERNAME)

#reddit = praw.Reddit(client_id = 'ETCyhisKnLla9w',
#		     client_secret = 'jmYpEYiL85SSCBq-Gz47Zawhjto',
#                     username = '******',