Example #1
0
 def __init__(self):
     # Load the configuration file
     self.configs = self.parse_rc_file(self.rc_file)
     # Initialize PRAW and connect to Reddit
     self.r = praw.Reddit(self.configs["useragent"])
     self.r.login(self.configs["username"], self.configs["password"])
     # Initialize the cache
     self.cache = a858utils.Cache(a858utils.expand(self.cache_file))
     # Set to False to break the main loop
     self.running = True
 def __init__(self):
     # Load the configuration file
     self.configs = self.parse_rc_file(self.rc_file)
     # Initialize PRAW and connect to Reddit
     self.r = praw.Reddit(self.configs["useragent"])
     self.r.login(self.configs["username"], self.configs["password"])
     # Initialize the cache
     self.cache = a858utils.Cache(a858utils.expand(self.cache_file))
     # Set to False to break the main loop
     self.running = True
Example #3
0
 def parse_rc_file(rc_file):
     """Parse a config file and return a dictionary."""
     configs = []
     with open(a858utils.expand(rc_file), "r") as rc:
         l = rc.readlines()
     for i in l:
         if i == "\n" or i.lstrip()[0] == "#":
             continue
         c = i.rstrip().split(None, 1)
         if len(c) == 1:
             c.append(None)
         configs.append(c)
     return dict(configs)
 def parse_rc_file(rc_file):
     """Parse a config file and return a dictionary."""
     configs = []
     with open(a858utils.expand(rc_file), "r") as rc:
         l = rc.readlines()
     for i in l:
         if i == "\n" or i.lstrip()[0] == "#":
             continue
         c = i.rstrip().split(None, 1)
         if len(c) == 1:
             c.append(None)
         configs.append(c)
     return dict(configs)