Beispiel #1
0
    def __init__(self, rLink, rType=sortType.HOT, rLimit=25):
        rTypeTxt = typeStr(rType)
        lg.debug("comments::__init__ " +
                 rLink + "" +
                 rTypeTxt + " " +
                 str(rLimit))

        # TODO strip rlink to show in history
        self.rLink = rLink
        self.rType = rType

        self.currComment = 0

        rLimitTxt = None
        if rLimit is not 25:
            rLimitTxt = "limit="+str(rLimit)

        params = rLimitTxt

        self.r = request(rLink, params)

        self.ok = self.r.ok
        self.status = self.r.status

        if self.ok:
            self.json = self.r.json
            self.__fetchComments__()
Beispiel #2
0
    def __init__(self, rName, rType=sortType.HOT, rLimit=25):
        rTypeTxt = typeStr(rType)
        lg.debug("listing::__init__ " + rTypeTxt + " " + str(rLimit))

        self.rName = rName
        self.rType = rType

        if self.rName == "":
            self.rName = "front"

        self.currLine = 0
        rLimitTxt = None
        if rLimit is not 25:
            rLimitTxt = "limit=" + str(rLimit)
        # TODO add other options
        if rName is "":
            rTxt = "/"
        else:
            rTxt = "/r/" + rName + "/" + rTypeTxt + "/"

        params = rLimitTxt
        # add other options to params

        self.r = request(rTxt, params)
        # I should check if request went well

        self.ok = self.r.ok
        self.status = self.r.status

        if self.ok:
            self.json = self.r.json
            self.__fetchLinks__()
Beispiel #3
0
 def describe(self):
     """Print comments description"""
     return "COMMENTS: " + self.rLink + "(" + typeStr(self.rType) + ")"
Beispiel #4
0
 def describe(self):
     """Print listing description"""
     return "LISTING: " + self.rName + "(" + typeStr(self.rType) + ")"