Just started to try using PyQt5 to scrape product price on Amazon. here is the code to connect to the webpage. However, Amazon tends to display different prices depends on your delivery address (I guess the site get this info from the browser cookies if I chose a delivery address before). In the case of using PyQt5, how can I use a custom cookie profile to connect to Amazon and get country-specific pricing information?
class Page(QWebEnginePage):
def __init__(self, URL):
self.app = QApplication(sys.argv)
QWebEnginePage.__init__(self)
QWebEngineProfile.__init__(self)
self.html = ''
self.loadFinished.connect(self._on_load_finished)
self.load(QUrl(url))
self.app.exec_()
def _on_load_finished(self):
self.html = self.toHtml(self.Callable)
print('Load finished')
def Callable(self, html_str):
self.html = html_str
self.app.quit()