예제 #1
0
 def get_orcid_data(self, orcid_string):
     self.repok.new_article()
     self.reper.new_article()
     self.__last_query_done = ORCIDFinder.__personal_url % orcid_string
     return get_data(self.max_iteration, self.sec_to_wait,
                     self.__last_query_done, self.headers, self.timeout,
                     self.repok, self.reper)
예제 #2
0
    def get_orcid_records(self, doi_string, family_names=[]):
        self.repok.new_article()
        self.reper.new_article()

        cur_query = "doi-self:\"%s\"" % doi_string
        doi_string_l = doi_string.lower()
        doi_string_u = doi_string.upper()
        if doi_string_l != doi_string or doi_string_u != doi_string:
            cur_query = "(" + cur_query
            if doi_string_l != doi_string:
                cur_query += " OR doi-self:" + doi_string_l
            if doi_string_u != doi_string:
                cur_query += " OR doi-self:" + doi_string_u
            cur_query += ")"

        if family_names:
            cur_query += " AND ("
            first_name = True
            for idx, family_name in enumerate(family_names):
                if family_name is not None:
                    if first_name:
                        first_name = False
                    else:
                        cur_query += " OR "
                    cur_query += "family-name:\"%s\"" % na("" + family_name)

            cur_query += ")"

        self.__last_query_done = ORCIDFinder.__api_url + quote(cur_query)

        return get_data(self.max_iteration, self.sec_to_wait,
                        self.__last_query_done, self.headers, self.timeout,
                        self.repok, self.reper)
예제 #3
0
    def __get_data(self, get_url, is_json=True):
        if self.sec_threshold is None:
            self.sec_threshold = datetime.now()
        if self.query_count % self.max_query_per_sec == 0:
            self.query_count = 1
            if (datetime.now() - self.sec_threshold).seconds == 0:
                sleep(1)

            self.sec_threshold = datetime.now()
        else:
            self.query_count += 1

        return get_data(self.max_iteration, self.sec_to_wait, get_url,
                        self.headers, self.timeout, self.repok, self.reper,
                        is_json)
예제 #4
0
    def get_orcid_records(self, doi_string, family_names=[]):
        self.repok.new_article()
        self.reper.new_article()

        cur_query = "digital-object-ids:\"%s\"" % doi_string
        if family_names:
            cur_query += " AND ("
            first_name = True
            for idx, family_name in enumerate(family_names):
                if family_name is not None:
                    if first_name:
                        first_name = False
                    else:
                        cur_query += " OR "
                    cur_query += "family-name:\"%s\"" % na("" + family_name)

            cur_query += ")"

        self.__last_query_done = ORCIDFinder.__api_url + quote(cur_query)

        return get_data(self.max_iteration, self.sec_to_wait,
                        self.__last_query_done, self.headers, self.timeout,
                        self.repok, self.reper)
예제 #5
0
 def __process_entity(self, entity, api_url):
     return get_data(self.max_iteration, self.sec_to_wait, api_url + entity,
                     self.headers, self.timeout, self.repok, self.reperr)