src/reddit_bot.py
def authenticate(self, max_attempts=-1, seconds_between_attempts=60):
        """Authenticates SITE_NAME with Reddit.
        Sets self.reddit and self.username on success.

        Parameters
        ----------
        max_attempts : int, optional
            Maximum number of authentication attempts before failure.
            Defaults to -1 (infinite attempts).
        seconds_between_attempts : int, optional
            Seconds to wait between authentication attempts.
            Defaults to 60.

        """
        attempt = 0
        while attempt != max_attempts:
            try:
                print("Authenticating as {}...".format(self.site_name))
                self.reddit = praw.Reddit(self.site_name)
                self.username = self.reddit.user.me()
                print("Successfully authenticated as {}".format(self.username))
                return
            except praw.exceptions.APIException as error:
                print("Unable to authenticate:", error)
                print("Retrying in {} "
                      "seconds".format(seconds_between_attempts))
                sleep(seconds_between_attempts)
                attempt += 1
        raise RuntimeError('Failed to authenticate after {} '
                           'attempts'.format(max_attempts))
Authenticates SITE_NAME with Reddit.
        Sets self.reddit and self.username on success.

        Parameters
        ----------
        max_attempts : int, optional
            Maximum number of authentication attempts before failure.
            Defaults to -1 (infinite attempts).
        seconds_between_attempts : int, optional
            Seconds to wait between authentication attempts.
            Defaults to 60.

        
Authenticates SITE_NAME with Reddit.

Parameters

max_attempts : int, optional
Maximum number of authentication attempts before failure.
Defaults to -1 (infinite attempts).
seconds_between_attempts : int, optional
Seconds to wait between authentication attempts.
Defaults to 60.
Authenticates SITE_NAME with Reddit . Parameters max_attempts : int optional Maximum number of authentication attempts before failure . Defaults to - 1 ( infinite attempts ) . seconds_between_attempts : int optional Seconds to wait between authentication attempts . Defaults to 60 .
def authenticate(self, max_attempts=-1, seconds_between_attempts=60):
        attempt = 0
        while attempt != max_attempts:
            try:
                print("Authenticating as {}...".format(self.site_name))
                self.reddit = praw.Reddit(self.site_name)
                self.username = self.reddit.user.me()
                print("Successfully authenticated as {}".format(self.username))
                return
            except praw.exceptions.APIException as error:
                print("Unable to authenticate:", error)
                print("Retrying in {} "
                      "seconds".format(seconds_between_attempts))
                sleep(seconds_between_attempts)
                attempt += 1
        raise RuntimeError('Failed to authenticate after {} '
                           'attempts'.format(max_attempts))
def authenticate ( self , max_attempts = - 1 , seconds_between_attempts = 60 ) : attempt = 0 while attempt != max_attempts : try : print ( "Authenticating as {}..." . format ( self . site_name ) ) self . reddit = praw . Reddit ( self . site_name ) self . username = self . reddit . user . me ( ) print ( "Successfully authenticated as {}" . format ( self . username ) ) return except praw . exceptions . APIException as error : print ( "Unable to authenticate:" , error ) print ( "Retrying in {} " "seconds" . format ( seconds_between_attempts ) ) sleep ( seconds_between_attempts ) attempt += 1 raise RuntimeError ( 'Failed to authenticate after {} ' 'attempts' . format ( max_attempts ) )
Authenticates SITE_NAME with Reddit.
Authenticates SITE_NAME with Reddit .
"""Authenticates SITE_NAME with Reddit.
        Sets self.reddit and self.username on success.

        Parameters
        ----------
        max_attempts : int, optional
            Maximum number of authentication attempts before failure.
            Defaults to -1 (infinite attempts).
        seconds_between_attempts : int, optional
            Seconds to wait between authentication attempts.
            Defaults to 60.

        """
self
max_attempts
seconds_between_attempts