App/Model.py
def clean_relwork(self, rurl, soup, elem, clean):
        # TODO: remove after implement the Topic() class
        """
        process the scraped data from the beatifulSoup object and saves the
        related work information into a JSON files

        Args:
            rurl (str): domain root URL to complete the related-work link
            soup (bs-obj): beatifulSoup object with the related-work data
            elem (str): HTML <div> keyword to scrap the related-work data
            clean (list): secondary <div> to clean the related-work data

        Raises:
            exp: raise a generic exception if something goes wrong

        Returns:
            ans (dict): Element (paint) clean related-work
        """
        try:
            # default answer
            ans = dict()

            # checking if searchtags exists
            if soup is not None:

                # finding searhtags <article> in the sou
                relworks = soup[0].findAll(elem)

                # processing related work
                i = 1
                for rw in relworks:
                    # cleaning data and getting all keys and values
                    key = str(rw.find(clean[0]).string)
                    key = self.clrtext(key)

                    url = rw.find(clean[1])
                    url = url.get(clean[2])
                    value = str(urllib.parse.urljoin(rurl, url))

                    # may names are similar in related work
                    if key in ans.keys():

                        # creating alternate key for the dict
                        key = key + " " + str(i)
                        i += 1

                    # updating answer dict
                    td = {key: value}
                    ans.update(copy.deepcopy(td))

            # returning answer
            return ans

        # exception handling
        except Exception as exp:
            Err.reraise(exp, "Gallery: clean_relwork")

        process the scraped data from the beatifulSoup object and saves the
        related work information into a JSON files

        Args:
            rurl (str): domain root URL to complete the related-work link
            soup (bs-obj): beatifulSoup object with the related-work data
            elem (str): HTML <div> keyword to scrap the related-work data
            clean (list): secondary <div> to clean the related-work data

        Raises:
            exp: raise a generic exception if something goes wrong

        Returns:
            ans (dict): Element (paint) clean related-work
        
process the scraped data from the beatifulSoup object and saves the
related work information into a JSON files
process the scraped data from the beatifulSoup object and saves the related work information into a JSON files
def clean_relwork(self, rurl, soup, elem, clean):
        try:
            ans = dict()
            if soup is not None:
                relworks = soup[0].findAll(elem)
                i = 1
                for rw in relworks:
                    key = str(rw.find(clean[0]).string)
                    key = self.clrtext(key)
                    url = rw.find(clean[1])
                    url = url.get(clean[2])
                    value = str(urllib.parse.urljoin(rurl, url))
                    if key in ans.keys():
                        key = key + " " + str(i)
                        i += 1
                    td = {key: value}
                    ans.update(copy.deepcopy(td))
            return ans
        except Exception as exp:
            Err.reraise(exp, "Gallery: clean_relwork")
def clean_relwork ( self , rurl , soup , elem , clean ) : try : ans = dict ( ) if soup is not None : relworks = soup [ 0 ] . findAll ( elem ) i = 1 for rw in relworks : key = str ( rw . find ( clean [ 0 ] ) . string ) key = self . clrtext ( key ) url = rw . find ( clean [ 1 ] ) url = url . get ( clean [ 2 ] ) value = str ( urllib . parse . urljoin ( rurl , url ) ) if key in ans . keys ( ) : key = key + " " + str ( i ) i += 1 td = { key : value } ans . update ( copy . deepcopy ( td ) ) return ans except Exception as exp : Err . reraise ( exp , "Gallery: clean_relwork" )
process the scraped data from the beatifulSoup object and saves the
related work information into a JSON files
process the scraped data from the beatifulSoup object and saves the related work information into a JSON files
# TODO: remove after implement the Topic() class """
        process the scraped data from the beatifulSoup object and saves the
        related work information into a JSON files

        Args:
            rurl (str): domain root URL to complete the related-work link
            soup (bs-obj): beatifulSoup object with the related-work data
            elem (str): HTML <div> keyword to scrap the related-work data
            clean (list): secondary <div> to clean the related-work data

        Raises:
            exp: raise a generic exception if something goes wrong

        Returns:
            ans (dict): Element (paint) clean related-work
        """ # default answer # checking if searchtags exists # finding searhtags <article> in the sou # processing related work # cleaning data and getting all keys and values # may names are similar in related work # creating alternate key for the dict # updating answer dict # returning answer # exception handling
ans (dict): Element (paint) clean related-work
ans ( dict ) : Element ( paint ) clean related - work
raise a generic exception if something goes wrong
raise a generic exception if something goes wrong
exp
self
rurl
domain root URL to complete the related-work link
domain root URL to complete the related - work link
soup
beatifulSoup object with the related-work data
beatifulSoup object with the related - work data
elem
HTML  keyword to scrap the related-work data
HTML keyword to scrap the related - work data
clean
secondary  to clean the related-work data
secondary to clean the related - work data