コード例 #1
0
 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.")
コード例 #2
0
 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!")
コード例 #3
0
 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")
コード例 #4
0
ファイル: store.py プロジェクト: Akash1507/Notif
 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")
コード例 #5
0
 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")
コード例 #6
0
ファイル: store.py プロジェクト: shravansundaram/pycharm
 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")
コード例 #7
0
ファイル: store.py プロジェクト: matthewwoo-zz/price-alert
 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")
コード例 #8
0
 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."
             )
コード例 #9
0
    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")
コード例 #10
0
 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!"
         )
コード例 #11
0
ファイル: store.py プロジェクト: aurebrus/Achtung
 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!")
コード例 #12
0
 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ó!")
コード例 #13
0
ファイル: store.py プロジェクト: SubokLang/price_watch
    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")
コード例 #14
0
ファイル: store.py プロジェクト: jheel4/price-alerts
 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")
コード例 #15
0
 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!")
コード例 #16
0
ファイル: store.py プロジェクト: junw3i/carousell
 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")
コード例 #17
0
 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!")
コード例 #18
0
ファイル: store.py プロジェクト: alexasih/Learning
 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!")
コード例 #19
0
ファイル: store.py プロジェクト: racode/price-checker
 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")
コード例 #20
0
ファイル: store.py プロジェクト: Nebby85/price-of-chair
 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!")
コード例 #21
0
ファイル: store.py プロジェクト: mhdphp/pricing-service-do
 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.')
コード例 #22
0
ファイル: store.py プロジェクト: prash254/price-of-chair-self
 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")
コード例 #23
0
 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
コード例 #24
0
 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"
             )
コード例 #25
0
 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")
コード例 #26
0
ファイル: store.py プロジェクト: malone5/price_checker
 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 "
             )
コード例 #27
0
 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."
             )
コード例 #28
0
 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'
             )
コード例 #29
0
ファイル: store.py プロジェクト: nmartinovic/price-of-chair
 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"
             )
コード例 #30
0
 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"
             )