




from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

__SCREAMING_SNAKE_CASE    :   Optional[int]       ="""https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"""

def 			lowerCAmelCase_			(  lowerCamelCase:       str     ,				lowerCamelCase:       str						)					->			list | None:


      '''simple docstring'''




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

            lowerCamelCase__        =				BASE_URL.format(lowerCamelCase     ,				lowerCamelCase						)
            lowerCamelCase__        =				get(lowerCamelCase						)

            # Is the response ok?
            response.raise_for_status()

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

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

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

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

      __SCREAMING_SNAKE_CASE    :   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:
                  __SCREAMING_SNAKE_CASE    :   int       =pharmacy_price["""pharmacy_name"""]
                  __SCREAMING_SNAKE_CASE    :   List[Any]       =pharmacy_price["""price"""]

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





from ..utils import DummyObject, requires_backends






class 			A			(		metaclass=_lowerCAmelCase		):
     """simple docstring"""

     _snake_case:	Optional[Any]     =["torch", "transformers", "invisible_watermark"]




     def __init__(    self  :   Dict	,  *A__  :   Optional[int]	,  **A__  :   Dict			)				->       Union[str, Any]:
           requires_backends(self	,  ['torch', 'transformers', 'invisible_watermark']			)




     @classmethod
     def  __snake_case   (    cls  :   Optional[int]	,  *A__  :   Dict	,  **A__  :   List[str]			)				->       Union[str, Any]:
           requires_backends(cls	,  ['torch', 'transformers', 'invisible_watermark']			)




     @classmethod
     def  __snake_case   (    cls  :   Optional[Any]	,  *A__  :   Dict	,  **A__  :   List[Any]			)				->       Dict:
           requires_backends(cls	,  ['torch', 'transformers', 'invisible_watermark']			)






class 			A			(		metaclass=_lowerCAmelCase		):
     """simple docstring"""

     _snake_case:	Dict     =["torch", "transformers", "invisible_watermark"]




     def __init__(    self  :   List[str]	,  *A__  :   str	,  **A__  :   int			)				->       List[Any]:
           requires_backends(self	,  ['torch', 'transformers', 'invisible_watermark']			)




     @classmethod
     def  __snake_case   (    cls  :   str	,  *A__  :   Any	,  **A__  :   Dict			)				->       Optional[Any]:
           requires_backends(cls	,  ['torch', 'transformers', 'invisible_watermark']			)




     @classmethod
     def  __snake_case   (    cls  :   List[str]	,  *A__  :   Optional[Any]	,  **A__  :   int			)				->       Dict:
           requires_backends(cls	,  ['torch', 'transformers', 'invisible_watermark']			)