Guest User

controller.py

a guest
Dec 26th, 2022
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. from PyQt5.QtCore import QThread
  2. import threading
  3.  
  4. from scrape_shopee_controller import scrape_shopee
  5. from scrape_ruten_controller import scrape_ruten
  6.  
  7. class controller(QThread):
  8. def __init__(self, keyword, pages, type):
  9. self.keyword = keyword
  10. self.pages = pages
  11. self.type = type
  12. self.online_store_type()
  13.  
  14. def online_store_type(self):
  15. if self.type == 'Shopee':
  16. self.thread_shopee = threading.Thread(target=self.shopee_control)
  17. self.thread_shopee.start()
  18. elif self.type == 'Ruten':
  19. self.thread_ruten = threading.Thread(target=self.ruten_control)
  20. self.thread_ruten.start()
  21.  
  22. def shopee_control(self):
  23. scrape_shopee(self.keyword, self.pages)
  24.  
  25. def ruten_control(self):
  26. scrape_ruten(self.keyword, self.pages)
  27.  
Add Comment
Please, Sign In to add comment