






'''simple docstring'''
from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

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

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase )				->				list | None:






					"""simple docstring"""







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

										a_									=   BASE_URL.format(_UpperCAmelCase					,  _UpperCAmelCase )
										a_									=   get(_UpperCAmelCase )

										# Is the response ok?
										response.raise_for_status()

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

										# This list will store the name and price.
										a_									=   []

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

																				# Get price of the drug.
																				a_									=   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
						__lowerCAmelCase							=input("Enter drug name: ").strip()
						__lowerCAmelCase							=input("Enter zip code: ").strip()

						__lowerCAmelCase							=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:
																		__lowerCAmelCase							=pharmacy_price["pharmacy_name"]
																		__lowerCAmelCase							=pharmacy_price["price"]

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









'''simple docstring'''
def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5) + 3_2					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) + 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5) + 4_9_1.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) - 3_2) * 5 / 9					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(((float(_UpperCAmelCase ) - 3_2) * 5 / 9) + 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) + 4_5_9.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) - 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(((float(_UpperCAmelCase ) - 2_7_3.1_5) * 9 / 5) + 3_2					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) - 4_9_1.6_7) * 5 / 9					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) - 4_5_9.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 5 / 9)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 1.2_5 + 2_7_3.1_5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 2.2_5 + 3_2)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 1.2_5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 2.2_5 + 3_2 + 4_5_9.6_7)					,  _UpperCAmelCase )


if __name__ == "__main__":
						import doctest

						doctest.testmod()

