def make_interface_object(self): if self.publisher_interface is not None: return # Create publisher object and initialize with a DOI or URL if self.doi is not None: publisher = pub_resolve.publisher_from_doi(self.doi) publisher.doi_or_url = self.doi elif self.url is not None: publisher = pub_resolve.publisher_from_url(self.url) publisher.doi_or_url = self.url else: publisher = None self.publisher_interface = publisher return
def get_paper_info(doi=None, url=None): """ Parameters ---------- doi : url : Returns ------- Errors ------ UnsupportedPublisherError : Retrieval of information from this publisher is not yet available """ if doi is not None: publisher = pub_resolve.publisher_from_doi(doi) paper_info = publisher.get_paper_info(doi=doi) elif url is not None: publisher = pub_resolve.publisher_from_url(url) paper_info = publisher.get_paper_info(url=url) else: raise Exception ''' # Resolve DOI or URL through PyPub pub_resolve methods publisher_base_url, full_url = pub_resolve.get_publisher_urls(doi=doi, url=url) pub_dict = pub_resolve.get_publisher_site_info(publisher_base_url) # Create a PaperInfo object to hold all information and call appropriate scraper paper_info = PaperInfo(doi=doi, scraper_obj=pub_dict['object'], url=full_url) paper_info.populate_info() ''' return paper_info