
from itertools import zip_longest

import requests
from bsa import BeautifulSoup
from pandas import DataFrame




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			str = "laptop")					->    Dict:






							'''simple docstring'''





							__UpperCamelCase	:   Optional[int]			   =					F'https://www.amazon.in/laptop/s?k={product}'
							__UpperCamelCase	:   Union[str, Any]			   =					{
							    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36\n        (KHTML, like Gecko)Chrome/44.0.2403.157 Safari/537.36",
							    "Accept-Language": "en-US, en;q=0.5",
							}
							__UpperCamelCase	:   Optional[Any]			   =					BeautifulSoup(requests.get(_lowerCamelCase						,  headers=_lowerCamelCase).text)
							# Initialize a Pandas dataframe with the column titles
							__UpperCamelCase	:   Tuple			   =					DataFrame(
							    columns=[
							        "Product Title",
							        "Product Link",
							        "Current Price of the product",
							        "Product Rating",
							        "MRP of the product",
							        "Discount",
							    ])
							# Loop through each entry and store them in the dataframe
							for item, _ in zip_longest(
							    soup.find_all(
							        "div"						,  attrs={"class": "s-result-item", "data-component-type": "s-search-result"}						,  )						,  soup.find_all("div"						,  attrs={"class": "a-row a-size-base a-color-base"})						,  ):
														try:
																					__UpperCamelCase	:   str			   =					item.ha.text
																					__UpperCamelCase	:   Tuple			   =					"https://www.amazon.in/" + item.ha.a["href"]
																					__UpperCamelCase	:   Optional[Any]			   =					item.find("span"						,  attrs={"class": "a-offscreen"}).text
																					try:
																												__UpperCamelCase	:   List[str]			   =					item.find("span"						,  attrs={"class": "a-icon-alt"}).text
																					except AttributeError:
																												__UpperCamelCase	:   List[Any]			   =					"Not available"
																					try:
																												__UpperCamelCase	:   Union[str, Any]			   =					(
																												    "₹"
																												    + item.find(
																												        "span"						,  attrs={"class": "a-price a-text-price"}).text.split("₹")[1]
																												)
																					except AttributeError:
																												__UpperCamelCase	:   Optional[int]			   =					""
																					try:
																												__UpperCamelCase	:   Optional[Any]			   =					float(
																												    (
																												        (
																												            float(product_mrp.strip("₹").replace(","						,  ""))
																												            - float(product_price.strip("₹").replace(","						,  ""))
																												        )
																												        / float(product_mrp.strip("₹").replace(","						,  ""))
																												    )
																												    * 100)
																					except ValueError:
																												__UpperCamelCase	:   Union[str, Any]			   =					float("nan")
														except AttributeError:
																					pass
														__UpperCamelCase	:   Union[str, Any]			   =					[
														    product_title,
														    product_link,
														    product_price,
														    product_rating,
														    product_mrp,
														    discount,
														]
							__UpperCamelCase	:   Optional[int]			   =					" "
							__UpperCamelCase	:   Any			   =					" "
							data_frame.index += 1
							return data_frame


if __name__ == "__main__":
		lowercase  :					Tuple													=       "headphones"
		get_amazon_product_data(product).to_csv(f"Amazon Product Data for {product}.csv")





def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       int	,							lowercase	:       int     ):


      '''simple docstring'''



      return int((input_a, input_a).count(1     ) != 0     )

def 			_SCREAMING_SNAKE_CASE			(							):


      '''simple docstring'''



      assert or_gate(0	,							0     ) == 0
      assert or_gate(0	,							1     ) == 1
      assert or_gate(1	,							0     ) == 1
      assert or_gate(1	,							1     ) == 1


if __name__ == "__main__":
 print(or_gate(0, 1))
 print(or_gate(1, 0))
 print(or_gate(0, 0))
 print(or_gate(1, 1))



