Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit adb1ab2

Browse files
Merge pull request avinashkranjan#2945 from avinashkranjan/deepsource-transform-1105f0f6
format code with autopep8
2 parents 1274fa6 + c0e8069 commit adb1ab2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎Amazon Price Tracker/script.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import smtplib
55
from email.mime.text import MIMEText
66

7+
78
def get_amazon_product_price(product_url):
89
headers = {
910
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
@@ -13,7 +14,7 @@ def get_amazon_product_price(product_url):
1314
if response.status_code == 200:
1415
soup = BeautifulSoup(response.content, 'html.parser')
1516
price_element = soup.find('span', id='priceblock_ourprice')
16-
17+
1718
if price_element:
1819
price_text = price_element.get_text()
1920
return price_text.strip()
@@ -23,6 +24,7 @@ def get_amazon_product_price(product_url):
2324
else:
2425
return "Failed to retrieve data from Amazon"
2526

27+
2628
def send_email(subject, message):
2729
sender_email = 'your_sender_email@gmail.com'
2830
sender_password = 'your_sender_password'
@@ -39,10 +41,11 @@ def send_email(subject, message):
3941
server.sendmail(sender_email, recipient_email, msg.as_string())
4042
server.quit()
4143

44+
4245
if __name__ == "__main__":
4346
amazon_product_url = "https://www.amazon.com/dp/B07RF1XD36/"
4447
target_price = 500 # Set your desired target price
45-
48+
4649
while True:
4750
current_price = get_amazon_product_price(amazon_product_url)
4851
print(f"Current Price: {current_price}")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /