def find_by_url(cls, url): for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The prescribed url prefix does not match.")
def find_by_url(cls, url): for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL Prefix used to find store didn't give any results!")
def find_by_url(cls, url): for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefixes(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL didnt match")
def find_by_url(cls, url): for i in range(0,len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The url prefix used to find store does not match any result")
def find_by_url(cls, url): for i in range(0, len(url)): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The Url Prefix used to find the store did not work")
def find_by_url(cls, url): for i in range(0, len(url)): try: store = cls.get_by_url_prefix(url[:1]) return store except: raise StoreErrors.StoreNotFoundException( "The URL prefix used to find the store came back empty")
def find_by_url(cls, url): for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used could not find a store")
def getByURL(cls, url): for i in range(0, len(url) + 1): try: store = cls.getByUrl_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL PREFIX USED TO FIND THE STORE DIDN'T GIVE US ANY RESULTS." )
def find_by_url(cls, url): for i in range(len(url)): try: store = Store.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL prefix used to find the URL doesn't give ant URL")
def find_by_url(cls, url): substr = url[:cls.find_nth_character(url, '/', 3)] try: store = cls.get_by_url_prefix(substr) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store didn't give us any results!" )
def find_by_url(cls, url): for i in range(len(url) + 1, 0, -1): try: store = cls.get_by_url_prefix(url[:i]) return store except: continue else: raise StoreErrors.StoreNotFoundException( "Nie znaleziono odpowiedniego sklepu!")
def find_by_url(cls, url): # return a store from the given url for i in range(0, len(url) + 1): try: if url.find("mall") != -1: print(url.find("mall")) store = cls.get_by_url_prefix("https://www.mall") elif url.find("xiaomi") != -1: print(url.find("xiaomi")) store = cls.get_by_url_prefix("http://xiaomishop") elif url.find("edigital") != -1: request = requests.get(url) content = request.content soup = BeautifulSoup(content, "html.parser") tag = "" query = "" if soup.title.string.find("Extreme") != -1: if soup.find("strong", "price price--large price--discount" ) is not None: tag = "strong" query = { "class": "price price--large price--discount" } elif (soup.find("strong", "price price--large ")) is not None: tag = "strong" query = {"class": "price price--large "} store = cls.get_by_url_prefix("https://edigital") store.query = query store.tag_name = tag elif url.find("ipon") != -1: print(url.find("xiaomi")) store = cls.get_by_url_prefix("https://ipon") elif url.find("emag") != -1: request = requests.get(url) content = request.content soup = BeautifulSoup(content, "html.parser") tag = "" query = "" if soup.title.string.find("eMAG.hu") != -1: # eMAG if soup.find("p", "product-old-price") is not None: tag = "p" query = {"class": "product-new-price"} else: tag = "p" query = {"class": "product-old-price"} store = cls.get_by_url_prefix("https://www.emag") store.query = query store.tag_name = tag return store except: raise StoreErrors.StoreNotFoundException( "A keresett prefix alapján a bolt nem található!")
def find_by_url(cls, url): """ :param url: item's URL :return: """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:1]) return store except: raise StoreErrors.StoreNotFoundException("Store not found")
def find_by_url(cls,url): """ return a store from a url like "http://www.johnlewis.com/item/123434dsfwe3" :param url: the item's url :return: a store, or raises a StoreNotFoundException """ for i in range(0,len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL prefix used to find the store didn't give us any results")
def find_by_url(cls, url): """ Return a store from a url like "http://www.amazon....." :param url: The item's url :return: aStore, or raises a StoreNotFoundException if no store matches the url """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL Prefix used to find the store didn't give us any results!")
def find_by_url(cls, url): """ return a store from a url :param url: :return: a store or a StoreNotFoundException """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("Store not found")
def find_by_url(cls, url): """ return a store from a url :param url: the item's url :return: store, or raises StoreNonFoundException """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL prefix used to find the store didn't give us any results!")
def find_by_url(cls, url): """ Return a store from a url like "http://johnlewis.com/item/asdfghj1235.html" :param url: The item's URL :return: a Store, or raises a StoreNotFoundException if no store matches the URL """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL Prefix used to find the store didn't give us any results!")
def find_by_url(cls, url): """ Return a store from a url like "https://rozetka.com.ua/msi_ge72mvr7rg_075xua/p31373959/" :param url: The item's URL :return: a Store, or raises StoreNotFound if no store matches URL """ for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL Prefix give us none results")
def find_by_url(cls, url): """ Return a store from a url like "http://www.webstore.com/items/nirqeinvq3iorvmq.html :param url: The item's URL :return: a Store, or raises a StoreNotFoundException if no store matches the URL """ for i in range(0, len(url)+1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException("The URL Prefix used to find the store didn't give any results!")
def find_by_url(cls, url): """ Return a store from url like : "http://www.johnlewis.com/item/akdowdkaewe.html" :param url: the item's URL :return: a Store, or raise StoreNotFoundException if no store matches the URL """ for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( 'No store found with this url.')
def find_by_url(cls, url): """ return a store from a url like "http://www.johnlewis.com/item/ss3h34hkk21.html" :param url: The item's URL :return: a Store, or raises a StoreNotFoundException if no store matches the URL """ pattern = re.compile(r'^(?P<url_prefix>[^:]*://[^/]+)') match = pattern.match(url) if match: store = cls.get_by_url_prefix(match.group('url_prefix')) return store raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store showed no results")
def find_by_url(cls, url): store = None for i in range(len(url) + 1): stores = cls.get_by_url_prefix(url[:i]) if len(stores) == 0: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store didn't give us any results!" ) else: store = stores[0] if len(stores) == 1: return store return store
def find_by_url(cls, url): """ :param url: items url :return: a store """ for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store not give us any results" )
def find_by_url(cls, url): ''' Returns a store from a full url with item :param url: item's url :return: store or raise a storenotfoundexception if no store matches the url ''' for i in range(20, len(url) + 1, 10): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix not found")
def find_by_url(cls, url): """ Return a store from a url like "https://steelseries.com/gaming-mice/rival-300" :param url: The items url :return: a Store, or raises a StoreNotFOundException if no store matches the url """ for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store did not produce results " )
def find_by_url(cls, url): """ Return a store from a url like "https://www.amazon.com/Canon-Mark-Frame-Digital-Camera/dp/B01KURGS9E/ref=sr_1_3?ie=UTF8&qid=1491077956&sr=8-3&keywords=eos+5d+mark+iv" :param url: The item's URL :return: a Store, or raises a StoreNotFoundException if no store matches the url """ for i in range(1, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store didn't give us any results." )
def find_by_url(cls, url): ''' Return a store from a url like "http://www.johnlewis.com/item/lwdjsdkjsd" :param url: The item's url :return: a Store, or raises a StoreNotFoundException if no store matches the URL ''' for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( 'The URL prefix used to find the store did not give us any results' )
def find_by_url(cls, url): ''' Return a store from a URL :param url: the irem's URL :return: a Store, or raises a StoreNotFoundException if no store matches the URL ''' for i in range(0, len(url) + 1): try: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL prefix used to find the store didn't return any results" )
def find_by_url(cls, url): for i in range(len(url) - 1, -1, -1): try: if Database.find_one( StoreConstants.COLLECTION, {'url_prefix': { "$regex": '^{}'.format(url[:i]) }}) is not None: store = cls.get_by_url_prefix(url[:i]) return store except: raise StoreErrors.StoreNotFoundException( "The URL Prefix used to find the store did not fetch any resutls" )