/ProductsArrivalNotices

During this serious Coronavirus period, hope my Arrival Notices project for products (like surgical mask :mask:, hand sanitizer :open_hands:, Medical Exam Gloves :snowman:) in market (Amazon) can help a little bit. :heart:

Primary LanguagePython

During this serious Coronavirus period, hope my Arrival Notices project for products (like surgical mask 😷, hand sanitizer 👐, Medical Exam Gloves ⛄) in market (Amazon) can help a little bit. ❤️
Ppl can also add in amazon links for their favorite products like toliet paper, switch if they like.


ProductsArrivalNotices

[Current Version - V3]

  1. This project can help you check whether 3 kinds (face mask, hand sanitizer, Medical Exam Gloves) of good-quality products (5 best sellers) in Amazon for protecting yourself in serious coronavirus period can be purchased now or not.
  2. This project can help you detect the process of product in a while loop, it will send you email automatically and repeatedly until you shuts down the program.
  3. This project can automaticly detect and update 5 best-seller links from best-seller products page (like the link below: https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Exam-Gloves/zgbs/industrial/8404645011) for 3 medical category in Amazon.
  4. This project allows user to store privacy information in a text, my main program can extract infromation from text.
  5. This project can let user type in link(s) for their ideal products.

[First Version & Second Version - V1 & V2]

  1. This project can help you check whether 3 kinds (face mask, hand sanitizer, Medical Exam Gloves) of good-quality products (5 best sellers) in Amazon for protecting yourself in serious coronavirus period can be purchased now or not.
  2. This project can help you detect the process of product in a while loop, it will send you email automatically and repeatedly until you shuts down the program.
  3. This project can automaticly detect and update 5 best-seller links from best-seller products page (like the link below: https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Exam-Gloves/zgbs/industrial/8404645011) for 3 medical category in Amazon.

Demo

Demo video for current version can be viewed here.
Demo video for V2 can be viewed here.
Demo video for V1 can be viewed here.

Images gallery

Demo images for this project can viewed below.

Content of email will be looked like below:

v1-img1

Current attachment looks like below:

v1-img4

Previous attachment looks like below:

Version 2:

v1-img3

Version 1:

v1-img2

How to set up this project?

First, please clone/download my project.

git clone https://github.com/zhou-1/productsArrivalNotices.git    

Second, in main_program_V3/info.txt file, (Please see the comments at the top of txt file carefully!!) add in your own gmail address, password of your gmail, and email address you would like to send email to.

TO=/XXXXX@outlook.com/
gmail_sender=/XXXXXXX@gmail.com/
gmail_passwd=/**********/

Third (optional), in main_program_V3/main.py file, you can also change the contents for subject, text of email if you like:

# email subject
SUBJECT = 'Here is the summary for products you are interested in!!'
# contents of email
# Send an attachment for report
TEXT = "Please download the attached txt file for your report."

Third, in your terminal, type in:

python main.py     

The program will run automatically and repeatedly; everytime when my program finishes one round, it will send an email with report as attachment to your "receive" email.

What you need?

Python 3
Libraries needed in Python:

  1. requests
  2. time
  3. smtplib
  4. email
  5. lxml
  6. re
  7. sys

Core parts

Currently, there are 3 core parts in my program.

1. Send email in Gmail with Python

Send email in gmail account with Python.
Here will be one popular quetion for "Login credentials with Gmail SMTP".
You could change the security level for SMTP Authentication Error in this link: https://support.google.com/accounts/answer/6010255
If you find the current status of security level is off like below image shows:
lsa1
After you trun on the security level, the status will show like velow image:
lsa2

2. Check availiabilty in website (Amazon)

Checking availaility in amazon website with product's ID.

# checking availaility 
XPATH_AVAILABILITY = '//div[@id ="availability"]//text()'
RAw_AVAILABILITY = doc.xpath(XPATH_AVAILABILITY) 
AVAILABILITY = ''.join(RAw_AVAILABILITY).strip()

This will return the result of product's availabilty based on its ID.

3. Check Top 5 products from Amazon's Best Seller page

Checking Top 5 best seller products from recommanded page.

# check for product link in href
XPATH_HREF = '//span[@class = "aok-inline-block zg-item"]/a[@class ="a-link-normal"]/@href'
RAw_HREF = doc.xpath(XPATH_HREF) 
#print(type(RAw_HREF)) # list

This will return a list for links for those 5 best-seller products.