コード例 #1
0
ファイル: sdk_crawler.py プロジェクト: ankoh/mc-server
    def get_profile_by_id(self, profile_id: str) -> Profile:
        if not self._initialized:
            log.critical("get_profile_by_id has been fired but the SDKCrawler was not initialized")
            return []

        profile = self._session.profiles.get(profile_id)
        return get_profile_from_json(profile.json)
コード例 #2
0
    def get_profile_by_id(self, profile_id: str) -> Profile:
        if not self._initialized:
            log.critical(
                "get_profile_by_id has been fired but the SDKCrawler was not initialized"
            )
            return []

        profile = self._session.profiles.get(profile_id)
        return get_profile_from_json(profile.json)
コード例 #3
0
ファイル: file_crawler.py プロジェクト: ankoh/mc-server
    def get_profile_by_id(self, profile_id: str) -> Profile:
        """
        Get profile object by profile_id
        :param profile_id:
        :return:
        """
        if not is_valid_mendeley_id(profile_id):
            return None

        # Construct a file path relative to the project root
        path = get_relative_path('test', 'samples', 'profiles', '%s.json' % profile_id)

        # Check if path exists
        if not exists(path):
            return None

        # If yes open and parse json
        with open(path, 'r', encoding="utf-8") as json_file:
            json_data = json.load(json_file)
            return get_profile_from_json(json_data)
コード例 #4
0
ファイル: file_crawler.py プロジェクト: ls1admin/mc-server
    def get_profile_by_id(self, profile_id: str) -> Profile:
        """
        Get profile object by profile_id
        :param profile_id:
        :return:
        """
        if not is_valid_mendeley_id(profile_id):
            return None

        # Construct a file path relative to the project root
        path = get_relative_path('test', 'samples', 'profiles',
                                 '%s.json' % profile_id)

        # Check if path exists
        if not exists(path):
            return None

        # If yes open and parse json
        with open(path, 'r', encoding="utf-8") as json_file:
            json_data = json.load(json_file)
            return get_profile_from_json(json_data)