def __init__(self, orcid_id, csv_file_name): self.data = {} self.orcid_id = orcid_id print '[i] ORCID {} will be processed'.format(self.orcid_id) self.csv_file_name = csv_file_name self.orcid = pyorcid.get(self.orcid_id) print '[i] data of from the ORCID retrieved'
def main(): """ (list) -> None Extrating bibtex from ORCID, saving it to the file """ separate_by_year = False import vlbalist as ol orcid_list = ol.orcid_list orcid_extracted = list() if not os.path.exists(TARGET_FODLER): os.makedirs(TARGET_FODLER) years = {} # extracting bibtex for key in orcid_list: name = key years[name] = list() orcidid = orcid_list[key] print('[i] extracting bibtex for {0}'.format(name)) orcid_obj = orcid.get(orcidid) # extracting bibtex try: orcid_bibtex = extract_bitex(orcid_obj, author=name) # years tmp_list = list() for key in orcid_bibtex: tmp_list.append(key) years[name] = sorted(tmp_list, reverse=True) # saving bibtex into separated files save_bibtex(bibtex=orcid_bibtex, file_prefix=name, separate=separate_by_year) orcid_extracted.append(name) except Exception as ex: _, _, ex_traceback = sys.exc_info() log_traceback(ex, ex_traceback) print(years) generate_bat(orcid_extracted, separate=separate_by_year, years=years)
def __init__(self, orcid_id, csv_file_name, load=True): """ (class, str, str, boolean) -> None Method that initialtes all very first activities. """ self.load = load self.data = {} self.orcid_id = orcid_id print '[i] ORCID {} will be processed'.format(self.orcid_id) self.csv_file_name = csv_file_name if self.load: self.orcid = pyorcid.get(self.orcid_id) print '[i] data of from the ORCID retrieved' else: print '[i] data won\'t be loaded, the already loaded bibtex will be used'
# main testing library import pyorcid as orcid # additional libraries import os import json import codecs # setting logging to the DEBUG mode import logging #logging.getLogger("#orcid#").setLevel(logging.DEBUG) logging.getLogger("#orcid#").setLevel(logging.INFO) #retrieve my own's profile from his ORCID me = orcid.get('0000-0001-5661-4587') TARGET_FODLER = 'generated' def print_keyword(obj): """ Printing author keywords """ print('[i] printing author keywords') for key_word in obj.keywords: print(key_word) def print_publications(obj): """ Printing author publications """