Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 889a265

Browse files
committed
Documentation: Inclusion of a docstring for the check_amazon_availability function in 'projects/Amazon Product Availbility/amazon.py' file
1 parent d516164 commit 889a265

File tree

1 file changed

+14
-3
lines changed
  • projects/Amazon Product Availbility Checker

1 file changed

+14
-3
lines changed

projects/Amazon Product Availbility Checker/amazon.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
from bs4 import BeautifulSoup
33

44

5-
def check_amazon_availability(product_url):
5+
def check_amazon_availability(product_url:str, user_agent:str) -> None:
6+
"""
7+
Checks if a provided product is still being available to buy on Amazon store just by providing its linked URL.
8+
9+
Attr:
10+
- product_url(str): URL of the product desired to check for its availability in Amazon Store.
11+
- user_agent(str): Personal Amazon user's User-Agent.
12+
13+
Return:
14+
- None
15+
"""
616
headers = {
7-
"User-Agent": "Your User Agent Here" # Replace with a valid user agent string
17+
"User-Agent": user_agent, # Replace with a valid user agent string
818
}
919

1020
try:
@@ -30,5 +40,6 @@ def check_amazon_availability(product_url):
3040

3141

3242
if __name__ == "__main__":
43+
user_agent = "YOUR_USER_AGENT_HERE"
3344
product_url = "YOUR_PRODUCT_URL_HERE"
34-
check_amazon_availability(product_url)
45+
check_amazon_availability(product_url, user_agent)

0 commit comments

Comments
 (0)