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

Docker logs not showing that test item is in stock and SMTP relay issue #59

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello, first, I would like to say that I like your project very much, and you have done a great job with it. However, I have run into some issues. I am using the SMTP relay method and when I start the container and look at the logs, the test item I am using (GT 710 on Amazon) is saying 'not in stock', even though it is. Am I doing something wrong? Additionally, when an item was shown in stock, it raised an exception called SMTPSenderRefused. I am using Gmail and I followed the guide for Postfix in the README. When I send a regular email from the terminal to myself using postfix, it sends, but for some reason, the docker container raised this error: File "/usr/local/lib/python3.9/smtplib.py", line 871, in sendmail raise SMTPSenderRefused(code, resp, from_addr) smtplib.SMTPSenderRefused: (530, b'5.7.0 Must issue a STARTTLS command first. h142sm5240210qke.104 - gsmtp', 'username@gmail.com')

What do you suggest? Any help is much appreciated, and I am very excited to get this thing working!

majorhavocgit commented 3 years ago

I had to add specifically add a starttls command in his alerter script, as well as specify credentials to get it to relay through gmail. I also enabled dual-authentication to be able to generate an app specific password in gmail, but I'm not sure if that's 100% necessary.

e.g. s.starttls() s.login('yourgmail@gmail.com','appgmailpassword')

ghost commented 3 years ago

Thanks for the help. Where should I add those two lines of code? I tried adding them after line 120 on alerter.py but it isn't working.

majorhavocgit commented 3 years ago

I'm not sure if you're looking at the current alerter.py, but I put both lines right before:

s.send_message(msg)

Also I don't think I used postfix. This was my reference if you want to dig further.

https://sites.google.com/site/cartwrightraspberrypiprojects/home/steps/add-ssmtp-mail

EricJMarti commented 3 years ago

I'm using gmail and not having any issues here. I have this in my /etc/postfix/main.cf:

pi@raspberrypi:~
$ cat /etc/postfix/main.cf | grep -i tls
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# Enable STARTTLS encryption
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

@CuppaJava123 Regarding your Amazon issue, it's possible that Amazon has detected that you are scraping their site and revoked access temporarily. I am investigating a workaround for this. I found that when this happens, I get a "missing title" error.