DryFishSuper / HermesCheck

A tool to check whether Hermes products are in stock.
10 stars 8 forks source link

ZeroDivisionError: integer division or modulo by zero 問題? #1

Open ElvinChen12 opened 4 years ago

ElvinChen12 commented 4 years ago

Hi您好,我在小红书上看到您的分享,刚好想拿您的项目练习下 我在自己的终端运行时出现如下报错:

我直接运行其他组件都是正常的,查询的sku输入网址查询也都存在,不知道是为什么呢? Traceback (most recent call last): File "C:/Users/Downloads/HermesCheck-master2/HermesCheck-master/main.py", line 28, in main() File "C:/Users/Downloads/HermesCheck-master2/HermesCheck-master/main.py", line 21, in main if has_stock(url, count): File "C:\Users\Downloads\HermesCheck-master2\HermesCheck-master\utils.py", line 92, in has_stock return check_stock_proxy_manager(url, get_proxy(get_all_proxies(proxy_file), count), count) File "C:\Users\Downloads\HermesCheck-master2\HermesCheck-master\utils.py", line 28, in get_proxy return proxies[count % len(proxies)] ZeroDivisionError: integer division or modulo by zero

DryFishSuper commented 4 years ago

如果没有代理,用本机运行的话,把 utils.py get_proxy 的函数,注释的内容取消,然后注释掉原来的 return 就行了。不过用本机一段时间就会被 block, 网站可能是根据 total request 来封 ip 的。所以还是用代理比较好。

ElvinChen12 commented 4 years ago

如果没有代理,用本机运行的话,把 utils.py get_proxy 的函数,注释的内容取消,然后注释掉原来的 return 就行了。不过用本机一段时间就会被 block, 网站可能是根据 total request 来封 ip 的。所以还是用代理比较好。

好的我正在一步步学习,用docker架代理那看起来又是另一个课题需要好好研究...我要先把程序跑通

我更正之后找了一个有库存的sku尝试了下显示如下报错 是我的Email无法连接吗? 两步骤验证我确认是关闭的

Traceback (most recent call last): File "C:/Users/Downloads/HermesCheck-master/main.py", line 28, in main() File "C:/Users/Downloads/HermesCheck-master/main.py", line 22, in main send_email(fromEmail=from_email, password=password, toEmail=to_email) File "C:\Users\Downloads\HermesCheck-master\utils.py", line 33, in send_email with smtplib.SMTP_SSL("smtp.gmail.com", "405") as server: File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\smtplib.py", line 1034, in init SMTP.init(self, host, port, local_hostname, timeout, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\smtplib.py", line 253, in init (code, msg) = self.connect(host, port) File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\smtplib.py", line 339, in connect self.sock = self._get_socket(host, port, self.timeout) File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\smtplib.py", line 1040, in _get_socket new_socket = socket.create_connection((host, port), timeout, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 808, in create_connection raise err File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 796, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

Process finished with exit code 1

zheminyao commented 4 years ago

@ElvinChen12 @DryFishSuper 您们好, 能否留一下联系方式,项目启动有一点问题,想要咨询一下

rexc0 commented 3 years ago

@DryFishSuper 能否留一下联系方式或小红书