





"""simple docstring"""




from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

UpperCamelCase_	 ="""https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"""





def 			a_							(				_lowercase			,		_lowercase  ):

						try:
												# Has user provided both inputs?
												if not drug_name or not zip_code:
																		return None

												_UpperCamelCase     :   Dict      =       BASE_URL.format(_lowercase			,		_lowercase  )
												_UpperCamelCase     :   Optional[int]      =       get(_lowercase  )

												# Is the response ok?
												response.raise_for_status()

												# Scrape the data using bs4
												_UpperCamelCase     :   Any      =       BeautifulSoup(response.text			,		'''html.parser'''  )

												# This list will store the name and price.
												_UpperCamelCase     :   Tuple      =       []

												# Fetch all the grids that contains the items.
												_UpperCamelCase     :   List[Any]      =       soup.find_all('''div'''			,		{'''class''': '''grid-x pharmCard'''}  )
												if grid_list and len(_lowercase  ) > 0:
																		for grid in grid_list:
																								# Get the pharmacy price.
																								_UpperCamelCase     :   List[Any]      =       grid.find('''p'''			,		{'''class''': '''list-title'''}  ).text

																								# Get price of the drug.
																								_UpperCamelCase     :   Union[str, Any]      =       grid.find('''span'''			,		{'''p''', '''price price-large'''}  ).text

																								pharmacy_price_list.append(
																								    {
																								        '''pharmacy_name''': pharmacy_name,
																								        '''price''': price,
																								    }  )

												return pharmacy_price_list

						except (HTTPError, exceptions.RequestException, ValueError):
												return None


if __name__ == "__main__":
						# Enter a drug name and a zip code
						UpperCamelCase_	 =input("""Enter drug name: """).strip()
						UpperCamelCase_	 =input("""Enter zip code: """).strip()

						UpperCamelCase_	 =fetch_pharmacy_and_price_list(
						    drug_name, zip_code
						)

						if pharmacy_price_list:
												print(F"\nSearch results for {drug_name} at location {zip_code}:")
												for pharmacy_price in pharmacy_price_list:
																		UpperCamelCase_	 =pharmacy_price["""pharmacy_name"""]
																		UpperCamelCase_	 =pharmacy_price["""price"""]

																		print(F"Pharmacy: {name} Price: {price}")
						else:
												print(F"No results found for {drug_name}")







a					:				Tuple       =      [0.4_85, 0.4_56, 0.4_06]
a					:				Optional[int]       =      [0.2_29, 0.2_24, 0.2_25]
a					:				List[Any]       =      [0.5, 0.5, 0.5]
a					:				Tuple       =      [0.5, 0.5, 0.5]
a					:				Optional[Any]       =      [0.48_14_54_66, 0.4_57_82_75, 0.40_82_10_73]
a					:				int       =      [0.26_86_29_54, 0.26_13_02_58, 0.27_57_77_11]






