Skip to content

Instantly share code, notes, and snippets.

@creativesalam
Forked from fnneves/amazon_bot_3.py
Created October 30, 2020 11:10
Show Gist options
  • Save creativesalam/98733ca2fead0746ba5874e609ecf470 to your computer and use it in GitHub Desktop.
Save creativesalam/98733ca2fead0746ba5874e609ecf470 to your computer and use it in GitHub Desktop.
tracker_log = pd.DataFrame() # later on, this will be your previous search history file
now = datetime.now().strftime('%Y-%m-%d %Hh%Mm')
log = pd.DataFrame({'date': now.replace('h',':').replace('m',''),
'code': prod_tracker.code[x], # this code comes from the TRACKER_PRODUCTS file
'url': url,
'title': title,
'buy_below': prod_tracker.buy_below[x], # this price comes from the TRACKER_PRODUCTS file
'price': price,
'stock': stock,
'review_score': review_score,
'review_count': review_count}, index=[x])
try:
# This is where you can integrate an email alert!
if price < prod_tracker.buy_below[x]:
print('************************ ALERT! Buy the '+prod_tracker.code[x]+' ************************')
except:
# sometimes we don't get any price, so there will be an error in the if condition above
pass
tracker_log = tracker_log.append(log) # appending the last product to the history log
print('appended '+ prod_tracker.code[x] +'\n' + title + '\n\n')
sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment