def request_doi_information_callback(self, p1, p2): text = DoiLookup.get_doi_information(self.doi) end_iterator = self.text_buffer.get_end_iter() self.text_buffer.insert(end_iterator, '\nDOI Information: \n') self.text_buffer.insert(end_iterator, json.dumps(text, indent=3)) self.requestDOIInformation.hide()
def use_doi_information(self, article): try: doi_information = DoiLookup.get_doi_information(article.doi) article.title = doi_information['title'] article.journal = doi_information['container-title'] except: pass return article
def request_doi_information_callback(self, p1, p2): text = DoiLookup.get_doi_information(self.doi) end_iterator = self.text.get_buffer().get_end_iter() self.text.get_buffer().insert(end_iterator, '\nDOI Information: \n') for k, v in text.items(): end_iterator = self.text.get_buffer().get_end_iter() self.text.get_buffer().insert(end_iterator, "%-*s: %s\n" % (15, k, v)) self.requestDOIInformation.hide()
def retrieve_information_based_on_doi(self): pattern = re.compile('DOI (.*)') res = pattern.match(self.id) if res: try: doi = res.group(1) res = DoiLookup.get_doi_information(doi) self.get_title_from_doi(res) self.get_publication_year_from_doi(res) self.get_journal_from_doi(res) self.get_author_information_from_doi(res) except Exception as e: print("retrieve_information_based_on_doi - error: %s" % e) else: print("Doi lookup failed: %s" % self.id)
def use_doi_information(self, article): try: doi_information = DoiLookup.get_doi_information(article.doi) print("Trying to get title and container-title based on doi") print(doi_information) temp = doi_information['message']['title'] print(temp) article.title = temp[0] print(article.title) article.journal = doi_information['message']['container-title'] print(article.journal) except Exception as e: print("lookup failed") print(e) return article