EricJMarti / inventory-hunter

⚡️ Get notified as soon as your next CPU, GPU, or game console is in stock
MIT License
1.12k stars 263 forks source link

TypeError: #80

Closed shattenjager closed 3 years ago

shattenjager commented 3 years ago

Traceback (most recent call last): File "/src/run.py", line 53, in main hunt(args, config, scrapers) File "/src/hunter.py", line 112, in hunt engine.run() File "/src/hunter.py", line 31, in run self.scheduler.run(blocking=True) File "/usr/local/lib/python3.9/sched.py", line 151, in run action(*argument, **kwargs) File "/src/hunter.py", line 51, in tick self.process_scrape_result(s, result) File "/src/hunter.py", line 98, in process_scrape_result self.alerter('Something went wrong', TypeError: __call__() takes 2 positional arguments but 3 were given

Seems like there is one argument missing from self.process_scrape_result(self, s, result) function, this is how I fixed it, adding the "seld" argument. I was getting this random error while monitoring the log, I think I fixed it, it's been running no problem for a good 30 mins. and I will create a PR for this.

shattenjager commented 3 years ago

Can't create a PR, anyway in hunter.py just use this in line 51: self.process_scrape_result(self, s, result) this is how I fixed it.

shattenjager commented 3 years ago

Well, seems like it's Newegg captcha that breaks it. W2020-12-08 03:40:21,947 [nwgg_3] missing title: https://www.newegg.com/areyouahuman?referer=/areyouahuman?referer=https%3A%2F%2Fwww.newegg.com%2Fp%2FN82E16868110293&why=8 W2020-12-08 03:40:21,947 [nwgg_3] missing buy box: https://www.newegg.com/areyouahuman?referer=/areyouahuman?referer=https%3A%2F%2Fwww.newegg.com%2Fp%2FN82E16868110293&why=8 E2020-12-08 03:40:21,948 [nwgg_3] got "are you a human" prompt E2020-12-08 03:40:21,948 [root] caught exception

EricJMarti commented 3 years ago

The exception should be fixed as of this commit: https://github.com/EricJMarti/inventory-hunter/commit/ce37330f92bad1acf2cd2882d66d3f22044c802f

Regarding the "are you a human" error, the only way to fix this is to increase your refresh interval. What happened is Newegg temporarily blocked your IP address because you were requesting data from their site too quickly. This can happen if you are running multiple Newegg scrapers in parallel, browsing Newegg while a scraper is running in the background, or one scraper is configured at a faster refresh interval. Typically, you can solve a CAPTCHA and they will unblock you.

shattenjager commented 3 years ago

Thank you! And thanks for the bot!! 👍