Skip to content

Commit

Permalink
Merge pull request #662 from RishavRaj20/patch-1
Browse files Browse the repository at this point in the history
Update amazon.py
  • Loading branch information
Mrinank-Bhowmick authored Dec 26, 2023
2 parents fd90dba + ab8fbf5 commit 9a31705
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions projects/Amazon Product Availbility Checker/amazon.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import requests
from bs4 import BeautifulSoup


def check_amazon_availability(product_url):
headers = {
"User-Agent": "Your User Agent Here" # You can set a user agent string here
"User-Agent": "Your User Agent Here" # Replace with a valid user agent string
}

try:
Expand All @@ -23,9 +22,10 @@ def check_amazon_availability(product_url):
else:
print(f"{title} is available on Amazon.")

except requests.exceptions.RequestException as e:
print("Error:", e)

except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
except requests.exceptions.RequestException as req_err:
print(f"Request error occurred: {req_err}")

if __name__ == "__main__":
product_url = "YOUR_PRODUCT_URL_HERE"
Expand Down

0 comments on commit 9a31705

Please sign in to comment.