geodesic.boson.dataset.Dataset.share#
- Dataset.share(servicer, alias=None, description=None, ttl=None, create_new=False, pin_version=False, broadcast=False, referer_allowlist=None, referer_blocklist=None, **extra_settings)[source]#
Shares a dataset, producing a token for unauthenticated users and apps.
- Parameters:
servicer (str) – The name of the servicer to use in the boson request.
alias (str | None) – An alias/nickname for the token. This is used to help users find tokens.
description (str | None) – A description of the token. This is used to help users understand the token’s purpose.
ttl (timedelta | int | float | None) – The time in until the dataset’s token should expire. Either a timedelta object or seconds Defaults to -1 (no expiration) if not provided.
create_new (bool) – If True, will create a new token even if one already exists. If ttl is greater than 0, this will always create a new token.
pin_version (bool) – If True, will pin the version of the dataset to the token. This means that the token will always return the same version of the dataset, even if the dataset changes.
broadcast (bool) – If True, will broadcast this dataset to the Boson Network, allowing it to be accessed on remote nodes.
referer_allowlist (List[str] | None) – A list of allowed referers for the token. If set, only requests from these referers will be allowed. The ‘Referer’ header will checked against this list using an exact prefix match.
referer_blocklist (List[str] | None) – A list of blocked referers for the token. If set, requests from these referers will be denied. The ‘Referer’ header will checked against this list using an exact prefix match.
extra_settings – A dictionary of extra settings to pass to scope this token - if you don’t know what this is for, don’t set directly.
- Raises:
requests.HTTPError – If the user is not permitted to access the dataset or if an error occurred
- Returns:
a share token and its corresponding data
- Return type:
Examples
>>> # Share a dataset with the 'geoservices' servicer that only allows traffic from >>> # https://goodwebsite.com and blocks traffic from https://maliciouswebsite.com. >>> # This token will expire in one hour >>> token = dataset.share( >>> servicer="geoservices", >>> ttl=3600, >>> referer_allowlist=["https://goodwebsite.com"], >>> referer_blocklist=["https://maliciouswebsite.com"] >>> )