API Reference

Adapter

Auth

class researchmap.adapter.Auth(client_id, client_secret, scope, *, iat=30, exp=30, sub='0', trial=False)

Researchmap authentication interface.

Parameters
  • client_id (str) – Client ID.

  • client_secret (bytes) – Client secret key.

Keyword Arguments
  • iat (int) – Issued at [sec].

  • exp (int) – Expire at [sec].

  • sub (int) – Subject.

  • trial (bool) – Trial mode.

property is_trial

Get trial mode.

Returns

Trial mode.

Return type

bool

property time_now

Get current time [aware].

Returns

Current time of UTC.

Return type

datetime.datetime

property time_iat

Get issued at time [aware].

Returns

Issued at time of UTC.

Return type

datetime.datetime

property time_exp

Get expire at time [aware].

Returns

Expire at time of UTC.

Return type

datetime.datetime

property token

Get token.

Returns

Token.

Return type

str

Raises
gen_jwt(*, exp=None, iat=None, sub=None)

Generate JWT.

Keyword Arguments
  • exp (int) – Expire at [sec].

  • iat (int) – Issued at [sec].

  • sub (int) – Subject.

Returns

JWT.

Return type

bytes

gen_pubkey(*, client_secret=None)

Generate public key.

Keyword Arguments

client_secret (str) – Client secret key.

Returns

Client public key.

Return type

bytes

is_authorization(*, _jwt=None, client_public=None)

Check authorization.

Keyword Arguments
  • _jwt (str) – JWT.

  • client_public (str) – Client public key.

Returns

True if authorization.

Return type

bool

Raises

jwt.InvalidTokenError – Invalid JWT.

get_access_token_response(*, _jwt=None, **kwargs)

Get access token.

Keyword Arguments

_jwt (bytes) – JWT.

Returns

Access token.

Return type

Optional[Union[list, dict]]

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

str

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

class researchmap.adapter.RequestsAdapter(authentication_key, trial=False)
get_bulk(params=None)

Get bulk data from the API.

Parameters

params (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

set_bulk(params=None, jsondata=None)

Set bulk data to the API.

Parameters
  • params (dict) – A dictionary containing the data to be set.

  • jsondata

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

set_bulk_apply(params=None)

Set bulk data to the API.

Parameters

params (dict) – A dictionary containing the data to be set.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

get_bulk_results(params=None)

Get bulk results from the API.

Parameters

params (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

search_researcher(payload=None)

Search for researchers.

Parameters

payload (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

get_researcher_profile(permalink, payload=None)

Get a researcher profile.

Parameters
  • permalink (str) – The permalink of the researcher.

  • payload (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

AiohttpAdapter

class researchmap.adapter.AiohttpAdapter(authentication_key, trial=False)
await get_bulk(payload=None)

Get bulk data from the API.

Parameters

payload (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

await search_researcher(payload=None)

Search for researchers.

Parameters

payload (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

await get_researcher_profile(permalink, payload=None)

Get a researcher profile.

Parameters
  • permalink (str) – The permalink of the researcher.

  • payload (dict) – A dictionary containing the parameters for the request.

Returns

A dictionary or list containing the data returned by the API.

Return type

dict or list

Wrapper

Wrapper

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.

Parameters

params (dict) – A dictionary containing the parameters to be passed to the API. The payload to send to the API. Defaults to None.

Return type

dict

set_bulk(jsondata=None, params=None)

Get a list of researchers from the API.

Parameters
  • jsondata (dict) – A dictionary containing the parameters to be passed to the API. The payload to send to the API. Defaults to None.

  • params (dict) – A dictionary containing the parameters to be passed to the API.

Return type

dict

set_bulk_apply(params=None)

Get a list of researchers from the API.

Parameters

params (dict) – A dictionary containing the parameters to be passed to the API.

Return type

dict

get_bulk_results(params=None)

Get a list of researchers from the API.

Parameters

params (dict) – A dictionary containing the parameters to be passed to the API.

Return type

dict

search_researcher(payload=None)

Search for a researcher in the API.

Parameters

payload (dict) – A dictionary containing the parameters to be passed to the API. The payload to send to the API. Defaults to None.

Return type

dict

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]

message

The Messages returned by Researchmap API.

Type

str

status

The status code of the HTTP request.

Type

int

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 HTTPException

Note

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 HTTPException

Note

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

  • Exception
    • ResearchmapException
      • HTTPException
        • UnsupportedResponseType

        • UnauthorizedClient

        • AccessDenied

        • InvalidClient

        • InvalidScope

        • InvalidGrant

        • UnsupportedGrantType

        • InvalidVersion

        • ParseError

        • InvalidNonce

        • InvalidRequest

        • InvalidToken

        • MalformedToken

        • InsufficientScope

        • InvalidIP

        • Forbidden

        • NotFound

        • MethodNotAllowed

        • MaxSearchResult

        • DatabaseError

        • ServerError

        • InternalServerError