





from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

__lowercase							:List[Any]							=	'https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true'







def    UpperCAmelCase				(  _lowerCamelCase   :	Any      , _lowerCamelCase   :	Any  ):





						'''simple docstring'''


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

												SCREAMING_SNAKE_CASE__  :					Dict =       BASE_URL.format(_UpperCamelCase      , _UpperCamelCase  )
												SCREAMING_SNAKE_CASE__  :					str =       get(_UpperCamelCase  )

												# Is the response ok?
												response.raise_for_status()

												# Scrape the data using bs4
												SCREAMING_SNAKE_CASE__  :					int =       BeautifulSoup(response.text      , "html.parser"  )

												# This list will store the name and price.
												SCREAMING_SNAKE_CASE__  :					List[Any] =       []

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

																								# Get price of the drug.
																								SCREAMING_SNAKE_CASE__  :					str =       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
				__lowercase							:int							=	input("Enter drug name: ").strip()
				__lowercase							:Dict							=	input("Enter zip code: ").strip()

				__lowercase							:list | None							=	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:
												__lowercase							:Tuple							=	pharmacy_price['pharmacy_name']
												__lowercase							:Optional[int]							=	pharmacy_price['price']

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




import math
from timeit import timeit


def 	_A	(   _UpperCamelCase			):
				_UpperCAmelCase						:  str     					=	0
				_UpperCAmelCase						:  Tuple     					=	abs(_UpperCamelCase			)
				while True:
								_UpperCAmelCase						:  str     					=	n // 10
								digits += 1
								if n == 0:
												break
				return digits


def 	_A	(   _UpperCamelCase			):
				return 1 if n == 0 else math.floor(math.log(abs(_UpperCamelCase			)      ,					10			) + 1			)


def 	_A	(   _UpperCamelCase			):
				return len(str(abs(_UpperCamelCase			)			)			)


def 	_A	(   ):
				from collections.abc import Callable

				def benchmark_a_function(_UpperCamelCase      ,					_UpperCamelCase			) -> None:
								_UpperCAmelCase						:  List[str]     					=	F'''{func.__name__}({value})'''
								_UpperCAmelCase						:  Any     					=	timeit(F'''__main__.{call}'''      ,					setup='''import __main__'''			)
								print(F'''{call}: {func(_UpperCamelCase			)} -- {timing} seconds'''			)

				for value in (262_144, 1_125_899_906_842_624, 1_267_650_600_228_229_401_496_703_205_376):
								for func in (num_digits, num_digits_fast, num_digits_faster):
												benchmark_a_function(_UpperCamelCase      ,					_UpperCamelCase			)
								print()


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					benchmark()
