Skip to content

Sign

obstore.sign

sign(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: str,
    expires_in: timedelta,
) -> str
sign(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: Sequence[str],
    expires_in: timedelta,
) -> List[str]
sign(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: str | Sequence[str],
    expires_in: timedelta,
) -> str | List[str]

Create a signed URL.

Given the intended method and paths to use and the desired length of time for which the URL should be valid, return a signed URL created with the object store implementation's credentials such that the URL can be handed to something that doesn't have access to the object store's credentials, to allow limited access to the object store.

Parameters:

  • store (SignCapableStore) –

    The ObjectStore instance to use.

  • method (HTTP_METHOD) –

    The HTTP method to use.

  • paths (str | Sequence[str]) –

    The path(s) within ObjectStore to retrieve. If

  • expires_in (timedelta) –

    How long the signed URL(s) should be valid.

Returns:

obstore.sign_async async

sign_async(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: str,
    expires_in: timedelta,
) -> str
sign_async(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: Sequence[str],
    expires_in: timedelta,
) -> List[str]
sign_async(
    store: SignCapableStore,
    method: HTTP_METHOD,
    paths: str | Sequence[str],
    expires_in: timedelta,
) -> str | List[str]

Call sign asynchronously.

Refer to the documentation for sign.

obstore.SignCapableStore module-attribute

SignCapableStore = AzureStore | GCSStore | S3Store

ObjectStore instances that are capable of signing.

obstore.HTTP_METHOD module-attribute

HTTP_METHOD = Literal[
    "GET",
    "PUT",
    "POST",
    "HEAD",
    "PATCH",
    "TRACE",
    "DELETE",
    "OPTIONS",
    "CONNECT",
]

Allowed HTTP Methods for signing.