Last active
October 30, 2020 11:10
-
-
Save fnneves/9903572b0df4bae81b54d1ae7b4e9d31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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