Advertisement
Guest User

Untitled

a guest
Aug 9th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. from . import tabun_api as t_api
  2. from . import bunker_api as b_api
  3. from . import utils
  4.  
  5.  
  6. class Api():
  7.  
  8.     def __init__(self, config):
  9.         self.config = config
  10.         self._login()
  11.  
  12.     def _login(self):
  13.         if self.config.site == 'tabun':
  14.             self.User = t_api.User(login=self.config.login, passwd=self.config.password)
  15.             print(self.User)
  16.         elif self.config.site == 'bunker':
  17.             self.User = b_api.User(login=self.config.login, password=self.config.password)
  18.             print(self.User)
  19.  
  20.     def get_stream(self):
  21.         if self.config.site == 'tabun':
  22.             s = self.User.get_comments("/comments/")
  23.             return utils.transform_comments_list(s, 'tabun')
  24.         elif self.config.site == 'bunker':
  25.             s = self.User.get_stream(comments='full')
  26.             return utils.transform_comments_list(s, 'bunker')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement