



from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

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


def 	_A	(   _UpperCamelCase      ,					_UpperCamelCase			):

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

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

								# Is the response ok?
								response.raise_for_status()

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

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

								# Fetch all the grids that contains the items.
								_UpperCAmelCase						:  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.
																_UpperCAmelCase						:  str     					=	grid.find('''p'''      ,					{'''class''': '''list-title'''}			).text

																# Get price of the drug.
																_UpperCAmelCase						:  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
					UpperCAmelCase__			:   int      			=    input('Enter drug name: ').strip()
					UpperCAmelCase__			:   Dict      			=    input('Enter zip code: ').strip()

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

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





from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


UpperCAmelCase__			:   Optional[int]      			=    {
    'configuration_ernie_m': ['ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ErnieMConfig'],
}

try:
					if not is_sentencepiece_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__			:   List[Any]      			=    ['ErnieMTokenizer']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__			:   Dict      			=    [
					    'ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'ErnieMForMultipleChoice',
					    'ErnieMForQuestionAnswering',
					    'ErnieMForSequenceClassification',
					    'ErnieMForTokenClassification',
					    'ErnieMModel',
					    'ErnieMPreTrainedModel',
					    'ErnieMForInformationExtraction',
					]


if TYPE_CHECKING:
					from .configuration_ernie_m import ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieMConfig

					try:
										if not is_sentencepiece_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_ernie_m import ErnieMTokenizer

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_ernie_m import (
										    ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ErnieMForInformationExtraction,
										    ErnieMForMultipleChoice,
										    ErnieMForQuestionAnswering,
										    ErnieMForSequenceClassification,
										    ErnieMForTokenClassification,
										    ErnieMModel,
										    ErnieMPreTrainedModel,
										)


else:
					import sys

					UpperCAmelCase__			:   Union[str, Any]      			=    _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
