def __init__(self, token): super(UnifiedCLIClient, self).__init__() self.token = token self.screen = Screen() self.__connected = False self.__logged = False self.loop = asyncio.get_event_loop() atexit.register(self.terminate)
# -*- coding: utf-8 -*- from datetime import datetime from libs.screen import Screen from libs.result import Result url = 'https://www.google.co.jp/' screen = Screen() screen.open(url) screen.wait('body') screen.snapshot('google') # Save capture and HTML # Sample of store to database record = {} record['url'] = url record['html'] = screen.get_html() record['scraped_at'] = datetime.now() result = Result() result.save(record)