示例#1
0
def list_works(orcid_id):
    response = orcid.get(orcid_id)
    print "Getting works for:", response.given_name, response.family_name
    id_list = []
    for pub in response.publications:
        if pub.external_ids:
            i = [id.type == 'DOI' for id in pub.external_ids].index(True)
            if i is not None:
                id_list.append(pub.external_ids[i].id)
        #except TypeError:
            #pass
    return id_list
示例#2
0
    def scrape(self):
        if not self.setting('orcid'):
            raise Exception("Must provide an ORCID.")

        if isinstance(self.setting('orcid'), basestring):
            orcids = [self.setting('orcid')]
        else:
            orcids = self.setting('orcid')

        responses = [orcid.get(orcd) for orcd in orcids]

        orcid_filepath = os.path.join(self.work_dir(), self.setting('orcid-data-file'))
        with open(orcid_filepath, 'wb') as f:
            pickle.dump(responses, f)
def getresearcher(orc):
    dois = []
    try:
        researcher = orcid.get(orc)
    except HTTPError:
        print "Failed to retrieve ORCID"
        return None, []
    try:
        pubs = researcher.publications
        for pub in pubs:
            if pub.external_ids:
                for exid in pub.external_ids:
                    if exid.type == 'DOI':
                        if exid.id not in dois:
                            dois.append(exid.id)
    except AttributeError:
        print "Obtained no public information from ORCID\n"
        return None, []
    return researcher, dois
示例#4
0
 def validate_realism(self, datatype, value, *args, **kwargs):
     r = kwargs.get("validation_response", plugin.ValidationResponse())
     oid = kwargs.get("oid", None)
     
     if oid is None:
         return r
     
     # now make a request to the ORCID service to see if this orcid is
     # resolvable
     author = orcid.get(oid)
     
     # FIXME: would be nice to error here, but we need to make sure that a
     # failure to connect to the orcid service does not cause a validation failure
     if author.orcid is None:
         r.warn("could not resolve orcid in the orcid database, so is highly likely to be wrong")
         return r
     
     # save the data we got back from orcid in case it is useful to the validator
     r.data = ORCIDWrapper(author._original_dict)
     return r
示例#5
0
import orcid
from pprint import pprint

authors = orcid.search('laszewski')

print authors

print next(authors).family_name

authors = orcid.search('wang')

print authors

for author in authors:
    a = author.family_name, author.given_name
    print a

gregor = orcid.get('0000-0001-9558-179X')
pprint(gregor)
print gregor.keywords

alfonso = orcid.get('0000-0001-8855-5569')
pprint(alfonso)
print alfonso.keywords
# print alfonso.publications

print gregor.publications()