API Reference

Adapter

Auth

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

Researchmap authentication interface.

Parameters
  • client_id (str) – Client ID.

  • client_secret (str) – Client secret.key.

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

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

  • sub (int) – Subject.

  • trial (bool) – Trial mode.

gen_jwt(*, exp: Optional[int] = None, iat: Optional[int] = None, sub: Optional[int] = None) bytes

Generate JWT.

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

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

  • sub (int) – Subject.

Returns

jwt auth token.

Return type

bytes

gen_pubkey(*, client_secret: Optional[str] = None) bytes

Generate public key.

Keyword Arguments

client_secret (str) – Client secret key.

Returns

public key.

Return type

bytes

get_access_token(*, access_token_response: Optional[Union[list, dict]] = None) str

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.

get_access_token_response(*, _jwt: Optional[str] = None, **kwargs) Optional[Union[list, dict]]

Get access token.

Keyword Arguments

_jwt (str) – 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.

is_authorization(*, _jwt: Optional[str] = None, client_public: Optional[str] = None) bool

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.

property is_trial: bool

Get trial mode.

Returns

Trial mode.

Return type

bool

property time_exp: datetime.datetime

Get expire at time [aware].

Returns

Expire at time of UTC.

Return type

datetime.datetime

property time_iat: datetime.datetime

Get issued at time [aware].

Returns

Issued at time of UTC.

Return type

datetime.datetime

property time_now: datetime.datetime

Get current time [aware].

Returns

Current time of UTC.

Return type

datetime.datetime

property token: str

Get token.

Returns

Token.

Return type

str

Raises

RequestsAdapter

class researchmap.adapter.RequestsAdapter(authentication_key: str)
get_bulk(payload=None) Optional[Union[list, dict]]

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

get_researcher_profile(permalink, payload=None) Optional[Union[list, dict]]

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

search_researcher(payload=None) Optional[Union[list, dict]]

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