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

Documentation: Inclusion of a docstring for the check_amazon_availabi… #819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions projects/Amazon Product Availbility Checker/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)