API Reference¶
Adapter¶
Auth¶
- defgen_jwt
- defgen_pubkey
- defget_access_token
- defget_access_token_response
- defis_authorization
- class researchmap.adapter.Auth(client_id, client_secret, scope, *, iat=30, exp=30, sub='0', trial=False)¶
Researchmap authentication interface.
- Parameters
- Keyword Arguments
- property time_now¶
Get current time [aware].
- Returns
Current time of UTC.
- Return type
- property time_iat¶
Get issued at time [aware].
- Returns
Issued at time of UTC.
- Return type
- property time_exp¶
Get expire at time [aware].
- Returns
Expire at time of UTC.
- Return type
- property token¶
Get token.
- Returns
Token.
- Return type
- Raises
InvalidToken – Invalid token.
json.JSONDecodeError – JSON decode error.
requests.exceptions.HTTPError – HTTP error.
- gen_jwt(*, exp=None, iat=None, sub=None)¶
Generate JWT.
- gen_pubkey(*, client_secret=None)¶
Generate public key.
- is_authorization(*, _jwt=None, client_public=None)¶
Check authorization.
- get_access_token_response(*, _jwt=None, **kwargs)¶
Get access token.
- Keyword Arguments
_jwt (
bytes) – JWT.- Returns
Access token.
- Return type
- Raises
HTTPException – An unknown HTTP related error occurred, usually when it isn’t 200 or the known incorrect credentials passing status code.
- get_access_token(*, access_token_response=None)¶
Get access token.
- Keyword Arguments
access_token_response – Access token response.
- Returns
Access token.
- Return type
- Raises
TypeError – The type of the argument is not correct.
HTTPException – An unknown HTTP related error occurred, usually when it isn’t 200 or the known incorrect credentials passing status code.
InvalidToken – Invalid token.
RequestsAdapter¶
- defget_bulk
- defget_bulk_results
- defget_researcher_profile
- defsearch_researcher
- defset_bulk
- defset_bulk_apply
- class researchmap.adapter.RequestsAdapter(authentication_key, trial=False)¶
- get_bulk(params=None)¶
Get bulk data from the API.
- set_bulk(params=None, jsondata=None)¶
Set bulk data to the API.
- set_bulk_apply(params=None)¶
Set bulk data to the API.
- get_bulk_results(params=None)¶
Get bulk results from the API.
- search_researcher(payload=None)¶
Search for researchers.
- get_researcher_profile(permalink, payload=None)¶
Get a researcher profile.
AiohttpAdapter¶
- asyncget_bulk
- asyncget_researcher_profile
- asyncsearch_researcher
Wrapper¶
Wrapper¶
- defget_bulk
- defget_bulk_results
- defsearch_researcher
- defset_bulk
- defset_bulk_apply
- class researchmap.wrapper.Wrapper(adapter)¶
Wrapper class for the Adapter class.
This class is used to wrap the Adapter class and provide a more convenient interface for the user.
- get_bulk(params=None)¶
Get a list of researchers from the API.
- set_bulk(jsondata=None, params=None)¶
Get a list of researchers from the API.
- set_bulk_apply(params=None)¶
Get a list of researchers from the API.
- get_bulk_results(params=None)¶
Get a list of researchers from the API.
Exceptions¶
The following exceptions are thrown by the library.
- exception researchmap.errors.HTTPException(response, messega, *, error=None)¶
Exception raised when an HTTP request fails.
- response¶
If you are using the RequestsAdapter,
requests.Response. If you are using the AiohttpAdapter,aiohttp.ClientResponse.- Type
Union[
aiohttp.ClientResponse,requests.Response]
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception researchmap.errors.UnsupportedResponseType(response, messega, *, error=None)¶
Exception raised when the response type is not supported. Subclass of
HTTPExceptionNote
Researchmap API v2 returns this error when the response type is not supported.
- exception researchmap.errors.UnauthorizedClient(response, messega, *, error=None)¶
Exception raised when the client is not authorized. Subclass of
HTTPExceptionNote
Researchmap API v2 returns this error when the client is not authorized in the current way.
-> Check if the client ID is correct and if the signature information by JWT is correct.
-> Also, this message will appear if you execute a Flow that is not allowed in grant_type when creating the client ID.
- exception researchmap.errors.AccessDenied(response, messega, *, error=None)¶
Exception raised when denied access. Subclass of
HTTPException
- exception researchmap.errors.InvalidClient(response, messega, *, error=None)¶
Exception raised when the client is invalid. Subclass of
HTTPException
- exception researchmap.errors.InvalidScope(response, messega, *, error=None)¶
Exception raised when the scope is invalid Subclass of
HTTPException
- exception researchmap.errors.InvalidGrant(response, messega, *, error=None)¶
Exception raised when the grant is invalid. Subclass of
HTTPException
- exception researchmap.errors.UnsupportedGrantType(response, messega, *, error=None)¶
Exception raised when the type of grant is not supported. Subclass of
HTTPException
- exception researchmap.errors.InvalidVersion(response, messega, *, error=None)¶
Exception raised when the version is invalid. Subclass of
HTTPException
- exception researchmap.errors.ParseError(response, messega, *, error=None)¶
Exception raised when error occurs during parsing. Subclass of
HTTPException
- exception researchmap.errors.InvalidNonce(response, messega, *, error=None)¶
Exception raised when the notce is invalid. Subclass of
HTTPException
- exception researchmap.errors.InvalidRequest(response, messega, *, error=None)¶
Exception raised when the request is invalid. Subclass of
HTTPException
- exception researchmap.errors.InvalidToken(response, messega, *, error=None)¶
Exception raised when the token is invalid. Subclass of
HTTPException
- exception researchmap.errors.MalformedToken(response, messega, *, error=None)¶
Exception raised when the token is malformed. Subclass of
HTTPException
- exception researchmap.errors.InsufficientScope(response, messega, *, error=None)¶
Exception raised when the scope of the request is insufficient. Subclass of
HTTPException
- exception researchmap.errors.InvalidIP(response, messega, *, error=None)¶
Exception raised when the ip is invalid. Subclass of
HTTPException
- exception researchmap.errors.Forbidden(response, messega, *, error=None)¶
Authorization failed. Please supply a valid auth_key parameter. Subclass of
HTTPException
- exception researchmap.errors.NotFound(response, messega, *, error=None)¶
The requested resource could not be found. Subclass of
HTTPException
- exception researchmap.errors.MethodNotAllowed(response, messega, *, error=None)¶
The requested method is not allowed. Subclass of
HTTPException
- exception researchmap.errors.MaxSearchResult(response, messega, *, error=None)¶
The requested limit is too large. Subclass of
HTTPException
- exception researchmap.errors.DatabaseError(response, messega, *, error=None)¶
The database is unavailable. Subclass of
HTTPException
- exception researchmap.errors.ServerError(response, messega, *, error=None)¶
The server is unavailable. Subclass of
HTTPException
- exception researchmap.errors.InternalServerError(response, messega, *, error=None)¶
Internal error Subclass of
HTTPException
Exception Hierarchy¶
ExceptionResearchmapExceptionHTTPExceptionUnsupportedResponseTypeUnauthorizedClientAccessDeniedInvalidClientInvalidScopeInvalidGrantUnsupportedGrantTypeInvalidVersionParseErrorInvalidNonceInvalidRequestInvalidTokenMalformedTokenInsufficientScopeInvalidIPForbiddenNotFoundMethodNotAllowedMaxSearchResultDatabaseErrorServerErrorInternalServerError