From 889a265539d8e07469aea91cac4e3c180c214b12 Mon Sep 17 00:00:00 2001 From: MarcoA-Pozol Date: Sun, 23 Mar 2025 17:45:42 -0600 Subject: [PATCH] Documentation: Inclusion of a docstring for the check_amazon_availability function in 'projects/Amazon Product Availbility/amazon.py' file --- .../amazon.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/projects/Amazon Product Availbility Checker/amazon.py b/projects/Amazon Product Availbility Checker/amazon.py index 6e1c10e0d..24047e2a7 100644 --- a/projects/Amazon Product Availbility Checker/amazon.py +++ b/projects/Amazon Product Availbility Checker/amazon.py @@ -2,9 +2,19 @@ from bs4 import BeautifulSoup -def check_amazon_availability(product_url): +def check_amazon_availability(product_url:str, user_agent:str) -> None: + """ + Checks if a provided product is still being available to buy on Amazon store just by providing its linked URL. + + Attr: + - product_url(str): URL of the product desired to check for its availability in Amazon Store. + - user_agent(str): Personal Amazon user's User-Agent. + + Return: + - None + """ headers = { - "User-Agent": "Your User Agent Here" # Replace with a valid user agent string + "User-Agent": user_agent, # Replace with a valid user agent string } try: @@ -30,5 +40,6 @@ def check_amazon_availability(product_url): if __name__ == "__main__": + user_agent = "YOUR_USER_AGENT_HERE" product_url = "YOUR_PRODUCT_URL_HERE" - check_amazon_availability(product_url) + check_amazon_availability(product_url, user_agent) \ No newline at end of file