Exemplo n.º 1
0
 def open(self):
     data = request.to_api('http://api.4chan.org/boards.json')
     for board_data in data['boards']:
         self.__boards[board_data['board']] = {
             'title' : board_data.get('title', 'unknown'),
             'pages' : board_data.get('pages', -1)
             }
Exemplo n.º 2
0
 def update(self, clear=False):
     if clear:
         self.__posts = {}
     posts = request.to_api(self.__translator.thread(self.__thread_id))
     posts = posts["posts"]
     for post in posts:
         self.__posts.update({post["no"]: post})
Exemplo n.º 3
0
 def update(self, clear=False):
     if clear:
         self.__posts = {}
     posts = request.to_api(self.__translator.thread(self.__thread_id))
     posts = posts['posts']
     for post in posts:
         self.__posts.update({post['no']: post})
Exemplo n.º 4
0
    def update(self, clear = False):
        if clear:
            self.__posts = {}

        for page in range(self.__translator.max_pages):
            try:
                threads = request.to_api(self.__translator.thread(page))['threads']
            except request.InvalidRequest:
                break

            for thread in threads:
                for post in thread['posts']:
                    self.__posts.update({post['no'] : post})
Exemplo n.º 5
0
    def update(self, clear=False):
        if clear:
            self.__posts = {}

        for page in range(self.__translator.max_pages):
            try:
                threads = request.to_api(
                    self.__translator.thread(page))['threads']
            except request.InvalidRequest:
                break

            for thread in threads:
                for post in thread['posts']:
                    self.__posts.update({post['no']: post})