
from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

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





def        lowerCAmelCase       (				snake_case__   :      Any				,					snake_case__   :      Tuple )->			list | None:



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

        A_								=					BASE_URL.format(__lowerCAmelCase				,					__lowerCAmelCase )
        A_								=					get(__lowerCAmelCase )

        # 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(__lowerCAmelCase ) > 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
     __magic_name__  :  Tuple     			=   input('Enter drug name: ').strip()
     __magic_name__  :  Any     			=   input('Enter zip code: ').strip()

     __magic_name__  :  Union[str, Any]     			=   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:
               __magic_name__  :  Tuple     			=   pharmacy_price['pharmacy_name']
               __magic_name__  :  Dict     			=   pharmacy_price['price']

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














from __future__ import annotations

import re


def __A       ( __lowerCAmelCase      )->    list[str]:





						"""simple docstring"""



						def alphanum_key(__lowerCAmelCase      ):
												return [int(__lowerCAmelCase      ) if s.isdigit() else s.lower() for s in re.split('([0-9]+)'					,						__lowerCAmelCase      )]

						return sorted(__lowerCAmelCase					,						key=__lowerCAmelCase      )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
