






"""simple docstring"""



from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

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


def      SCREAMING_SNAKE_CASE__    (   snake_case    :      str       , snake_case    :      str							)->						list | None:






     '''simple docstring'''



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

          UpperCAmelCase__		:  List[str]				=				BASE_URL.format(snake_case       , snake_case							)
          UpperCAmelCase__		:  List[Any]				=				get(snake_case							)

          # Is the response ok?
          response.raise_for_status()

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

          # This list will store the name and price.
          UpperCAmelCase__		:  str				=				[]

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

                    # Get price of the drug.
                    UpperCAmelCase__		:  List[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
 _lowerCAmelCase     :     Any            =	input("""Enter drug name: """).strip()
 _lowerCAmelCase     :     Union[str, Any]            =	input("""Enter zip code: """).strip()

 _lowerCAmelCase     :     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:
   _lowerCAmelCase     :     str            =	pharmacy_price["""pharmacy_name"""]
   _lowerCAmelCase     :     Union[str, Any]            =	pharmacy_price["""price"""]

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










"""simple docstring"""



from transformers import PretrainedConfig




class        lowerCAmelCase__       (  __magic_name__					):
   SCREAMING_SNAKE_CASE_					      ='''custom'''
   def __init__(						self	:     Any				,       snake_case__	:     Any=1				,       **snake_case__	:     Optional[Any]				):


        '''simple docstring'''
        UpperCAmelCase__		:  List[str]				=				attribute
        super().__init__(**snake_case__				)




class        lowerCAmelCase__       (  __magic_name__					):
   SCREAMING_SNAKE_CASE_					      ='''custom'''
   def __init__(						self	:     List[str]				,       snake_case__	:     Tuple=1				,       **snake_case__	:     str				):


        '''simple docstring'''
        UpperCAmelCase__		:  List[str]				=				attribute


