def _add_links(self, links, key="href", proxy_key="proxyURL", endpoints=None):
        """ Parses and adds block of links """
        if endpoints is None:
            endpoints = ["likes", "replies", "shares", "self", "followers",
                         "following", "lists", "favorites", "members"]

        if links.get("links"):
            for endpoint in links['links']:
                # It would seem occasionally the links["links"][endpoint] is
                # just a string (what would be the href value). I don't know
                # why, it's likely a bug in pump.io but for now we'll support
                # this too.
                if isinstance(links['links'][endpoint], dict):
                    self._add_link(endpoint, links['links'][endpoint]["href"])
                else:
                    self._add_link(endpoint, links["links"][endpoint])

        for endpoint in endpoints:
            if links.get(endpoint, None) is None:
                continue

            if "pump_io" in links[endpoint]:
                self._add_link(endpoint, links[endpoint]["pump_io"][proxy_key])
            elif "url" in links[endpoint]:
                self._add_link(endpoint, links[endpoint]["url"])
            else:
                self._add_link(endpoint, links[endpoint][key])

        return self.links
def _add_links ( self , links , key = "href" , proxy_key = "proxyURL" , endpoints = None ) : if endpoints is None : endpoints = [ "likes" , "replies" , "shares" , "self" , "followers" , "following" , "lists" , "favorites" , "members" ] if links . get ( "links" ) : for endpoint in links [ 'links' ] : if isinstance ( links [ 'links' ] [ endpoint ] , dict ) : self . _add_link ( endpoint , links [ 'links' ] [ endpoint ] [ "href" ] ) else : self . _add_link ( endpoint , links [ "links" ] [ endpoint ] ) for endpoint in endpoints : if links . get ( endpoint , None ) is None : continue if "pump_io" in links [ endpoint ] : self . _add_link ( endpoint , links [ endpoint ] [ "pump_io" ] [ proxy_key ] ) elif "url" in links [ endpoint ] : self . _add_link ( endpoint , links [ endpoint ] [ "url" ] ) else : self . _add_link ( endpoint , links [ endpoint ] [ key ] ) return self . links
Parses and adds block of links