App/Model.py
def clean_objdata(self, soup, elem):
        # TODO: remove after implement the Topic() class
        """
        Clean the page's object-data from the beatifulSoup object

        Args:
            soup (bs-obj): beatifulSoup object with the object-data data
            elem (str): HTML <div> keyword to scrap the object-data data

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

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

            # checking if object-data exists
            if soup is not None:

                # finding <dt> and <dd> from the soup
                keys = soup.findAll(elem[0])
                values = soup.findAll(elem[1])

                # soup keys and values must have data
                if len(keys) > 0 and len(values) > 0:

                    # looping over the <dt> and <dd> data
                    for key, value in zip(keys, values):

                        # cleaning data for dictionary
                        key = str(key.string)
                        key = self.clrtext(key)

                        value = str(value.string)
                        value = self.clrtext(value)

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

            # returning answer
            return ans

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

        Clean the page's object-data from the beatifulSoup object

        Args:
            soup (bs-obj): beatifulSoup object with the object-data data
            elem (str): HTML <div> keyword to scrap the object-data data

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

        Returns:
            ans (dict): Element (paint) clean object-data
        
Clean the page's object-data from the beatifulSoup object
Clean the page ' s object - data from the beatifulSoup object
def clean_objdata(self, soup, elem):
        try:
            ans = dict()
            if soup is not None:
                keys = soup.findAll(elem[0])
                values = soup.findAll(elem[1])
                if len(keys) > 0 and len(values) > 0:
                    for key, value in zip(keys, values):
                        key = str(key.string)
                        key = self.clrtext(key)
                        value = str(value.string)
                        value = self.clrtext(value)
                        td = {key: value}
                        ans.update(copy.deepcopy(td))
            return ans
        except Exception as exp:
            Err.reraise(exp, "Gallery: clean_objdata")
def clean_objdata ( self , soup , elem ) : try : ans = dict ( ) if soup is not None : keys = soup . findAll ( elem [ 0 ] ) values = soup . findAll ( elem [ 1 ] ) if len ( keys ) > 0 and len ( values ) > 0 : for key , value in zip ( keys , values ) : key = str ( key . string ) key = self . clrtext ( key ) value = str ( value . string ) value = self . clrtext ( value ) td = { key : value } ans . update ( copy . deepcopy ( td ) ) return ans except Exception as exp : Err . reraise ( exp , "Gallery: clean_objdata" )
Clean the page's object-data from the beatifulSoup object
Clean the page ' s object - data from the beatifulSoup object
# TODO: remove after implement the Topic() class """
        Clean the page's object-data from the beatifulSoup object

        Args:
            soup (bs-obj): beatifulSoup object with the object-data data
            elem (str): HTML <div> keyword to scrap the object-data data

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

        Returns:
            ans (dict): Element (paint) clean object-data
        """ # default answer # checking if object-data exists # finding <dt> and <dd> from the soup # soup keys and values must have data # looping over the <dt> and <dd> data # cleaning data for dictionary # temp dict for complete answer # updating answer dict # returning answer # exception handling
ans (dict): Element (paint) clean object-data
ans ( dict ) : Element ( paint ) clean object - data
raise a generic exception if something goes wrong
raise a generic exception if something goes wrong
exp
self
soup
beatifulSoup object with the object-data data
beatifulSoup object with the object - data data
elem
HTML  keyword to scrap the object-data data
HTML keyword to scrap the object - data data