123456789101112131415161718192021222324252627282930313233 |
- import sys
- import json
- sys.path.insert(0,'./kw_tools/web')
- import browser_common
- import rpyc
- from rpyc.utils.server import ThreadedServer
- class MyService(rpyc.Service):
- def __init__(self):
- self.jb=browser_common.JBrowser()
-
- self.jb.set_profile_path('"/home/jared/.config/google-chrome/"')
- def exposed_get_url(self,url):
- self.jb.get(url)
- driver=self.jb.get_driver()
- src=driver.page_source
- return json.loads(driver.find_element_by_tag_name('body').text)
- def exposed_get_driver(self):
- return self.jb.get_driver()
- if __name__ == "__main__":
- server = ThreadedServer(MyService, port = 12345)
- server.start()
|