Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #from layer7_utilities import Logger
  2.  
  3. class BaseOAuth(object):
  4. def __init__(self, __description__, __version__, __author__):
  5.  
  6. self.USR_AGNT = __description__ + " v" + __version__ + " by " + __author__
  7.  
  8. # Initialize the logger
  9. #self.logger = Logger('Countdown', __version__)
  10. #self.logger.debug('Initialized the BaseOAuth')
  11.  
  12. def login(self):
  13. import praw
  14. r = praw.Reddit(user_agent=self.USR_AGNT,
  15. client_id=self.APP_ID,
  16. client_secret=self.APP_SECRET,
  17. username=self.UNAME,
  18. password=self.PASSWD)
  19.  
  20. #self.logger.debug('{} | Created the Login'.format(r.user.me()))
  21. return r
  22.  
  23. def set_info(self, id, secret, username, password):
  24. self.APP_ID, self.APP_SECRET, self.UNAME, self.PASSWD = id, secret, username, password
  25. #self.logger.debug('Set the login info')
  26.  
  27. class oAuth(object):
  28. def __init__(self, id, __description__, __version__, __author__):
  29. self.usernames = [ # Sample. This should be replaced with strings with the actual information in them, _in this order_.
  30. # You may use as many accounts as you like.
  31. (app_id, app_secret, username, password),
  32. (app_id2, app_secret2, username2, password2)]
  33. #self.logger = Logger('Countdown', __version__)
  34.  
  35. self.accounts = []
  36. for i in self.usernames:
  37. x = BaseOAuth(__description__, __version__, __author__)
  38. x.set_info(*i)
  39. self.accounts.append(x)
  40.  
  41. #self.logger.debug('Retrieved the logins from the database')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement