Beispiel #1
0
 def run(self):
     reddit.login(user=self.user,password=self.password)
             
     
         
 
     
Beispiel #2
0
def bootup():
	
	version = "1.1"
	
	parse = argparse.ArgumentParser(description = 'makeswordclouds')
	parse.add_argument('-l', '--login', action = 'store_true', help = 'Login to a different account than config account')
	args = parse.parse_args()
	
	print('\nMWC // version ' + version)
	print('------------------')
	
	if not os.path.isfile(config_name) or not os.path.isfile(replied_name):
		
		config.write(current, config_name)
		config.write(replied_current, replied_name)
		print('> Created config.json & replied.json. Please edit the values in the config before continuing.')
		sys.exit()
		
	conf = config.load(config_name)
	
	if conf['limit'] == '':
		
		print('> The limit in the config is not set! Please set it to a proper number.')
		sys.exit()
		
	elif int(conf['limit']) > 200:
		
		print('> The limit in the config is over 200! Please make it a lower number.')
		sys.exit()
		
	if conf['id'] == '':
		
		print('> The id in the config is not set! Please set it to an Imgur client id.')
		sys.exit()
		
	user = conf['credentials']['username']
	passwd = conf['credentials']['password']
	
	current['credentials']['username'] = user
	current['credentials']['password'] = passwd
	current['limit'] = conf['limit']
	current['id'] = conf['id']
	
	if args.login or user == "" or passwd == "":
		
		user = raw_input('> Reddit username: '******'s password: " % user)
		
		print
		
	agent = (
		'/u/' + user + ' running makeswordclouds, version ' + version + ', created by /u/WinneonSword.'
	)
	
	r = praw.Reddit(user_agent = agent)
	utils = Utils(conf, r)
	
	reddit.login(user, passwd, r)
	loop(user, r, utils)
Beispiel #3
0
def main():
    accountsdb = database.opendb()
    r = reddit.login()
    while True:
        reddit.processinbox(r, accountsdb)
        reddit.awardposts(r, accountsdb)
Beispiel #4
0
def bootup():

    version = "1.1"

    parse = argparse.ArgumentParser(description='makeswordclouds')
    parse.add_argument('-l',
                       '--login',
                       action='store_true',
                       help='Login to a different account than config account')
    args = parse.parse_args()

    print('\nMWC // version ' + version)
    print('------------------')

    if not os.path.isfile(config_name) or not os.path.isfile(replied_name):

        config.write(current, config_name)
        config.write(replied_current, replied_name)
        print(
            '> Created config.json & replied.json. Please edit the values in the config before continuing.'
        )
        sys.exit()

    conf = config.load(config_name)

    if conf['limit'] == '':

        print(
            '> The limit in the config is not set! Please set it to a proper number.'
        )
        sys.exit()

    elif int(conf['limit']) > 200:

        print(
            '> The limit in the config is over 200! Please make it a lower number.'
        )
        sys.exit()

    if conf['id'] == '':

        print(
            '> The id in the config is not set! Please set it to an Imgur client id.'
        )
        sys.exit()

    user = conf['credentials']['username']
    passwd = conf['credentials']['password']

    current['credentials']['username'] = user
    current['credentials']['password'] = passwd
    current['limit'] = conf['limit']
    current['id'] = conf['id']

    if args.login or user == "" or passwd == "":

        user = raw_input('> Reddit username: '******'s password: " % user)

        print

    agent = ('/u/' + user + ' running makeswordclouds, version ' + version +
             ', created by /u/WinneonSword.')

    r = praw.Reddit(user_agent=agent)
    utils = Utils(conf, r)

    reddit.login(user, passwd, r)
    loop(user, r, utils)