osf_authenticate#

pypillometry.osf_authenticate(access_token, validate=True, session=None, timeout=10.0)[source]#

Authenticate against the OSF API using a personal access token.

Parameters:
  • access_token (str) – Personal access token generated on OSF.

  • validate (bool) – If True (default), verify the token by calling /v2/users/me/.

  • session (Optional[Session]) – Existing session to configure. If None, a new session is created.

  • timeout (float) – Timeout (in seconds) for the validation request when validate is True.

Return type:

Session

Returns:

Session configured with the OSF bearer token.

Raises:

ValueError – If no access token is provided or validation fails.