API reference
Generated from the source with mkdocstrings.
Client
bibliofabric.figshare.FigshareClient
Client for the Figshare REST API v2.
Public reads need no credentials. With api_token set the client
sends Authorization: token on every request, which unlocks private
item reads; the write routes stay out of scope. The client sends
Accept: application/json and a User-Agent on every request and
paces itself under the one request per second Figshare asks for.
Credentials resolve in the constructor: an explicit api_token or
mailto argument wins, then :class:FigshareSettings.
articles: ArticlesResource
cached
property
The articles resource client (every item kind, datasets included).
collections: CollectionsResource
cached
property
The collections resource client.
projects: ProjectsResource
cached
property
The projects resource client.
categories: CategoriesResource
cached
property
The categories resource client.
licenses: LicensesResource
cached
property
The licenses resource client.
item_types: ItemTypesResource
cached
property
The item types resource client.
altmetric_institutions: AltmetricInstitutionsResource
cached
property
The altmetric institutions resource client.
institutions: InstitutionsResource
cached
property
The institutions resource client (public article filter).
The sync twin FigshareSyncClient mirrors the client method for method
and exports from the same module: from bibliofabric.figshare import
FigshareSyncClient.
Settings
bibliofabric.figshare.FigshareSettings
Figshare-specific client settings.
Inherits timeout, max_retries, max_retry_wait,
max_requests_per_second, max_concurrency, user_agent and
mailto from :class:bibliofabric.config.BaseApiSettings and sets
Figshare defaults: 0.9 requests per second and concurrency 4, so the
default pace stays under the one request per second that Figshare asks
for. Public reads need no credentials; a personal token unlocks private
item reads and the write routes.
Resources
Each resource inherits the generic operations from bibliofabric.Resource
(get, search, iterate, collect, first). Only the members that
Figshare changes or adds are shown here.
bibliofabric.figshare.ArticlesResource
Client for the public /articles endpoints.
search, iterate, and collect read the POST body of
/articles/search; :meth:latest walks the plain GET /articles
list. count() is unsupported: Figshare answers bare JSON arrays and
reports no totals anywhere.
latest(filters: BaseModel | Mapping[str, Any] | None = None, *, sort: str | None = None, page: int | None = None, page_size: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[FigshareArticle]
async
Fetch one page of the newest public articles (GET /articles).
Accepts the same filters as :meth:search; sort takes one of
:data:ARTICLE_ORDER_FIELDS with an optional :asc or :desc.
versions(id: str | int, *, page: int | None = None, page_size: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[FigshareArticleVersionRef]
async
List the versions of one item, newest first.
Each entry carries the version number and the API URL of that
version; fetch the full record with :meth:version.
version(id: str | int, version: int) -> FigshareArticle
async
Fetch one published version of an item as a full record.
files(id: str | int) -> list[FigshareFile]
async
List the files of one item.
Returns the full listing; the files list embedded in a record
answer is the same shape.
file(id: str | int, file_id: str | int) -> FigshareFile
async
Fetch one file entry (metadata, no download).
download(id: str | int, dest: Path | str) -> Path
async
Stream every file of an item (as one archive) to dest.
The route answers a redirect to ndownloader.figshare.com, which
the core download follows to the storage host.
download_version(id: str | int, version: int, dest: Path | str) -> Path
async
Stream one published version of an item to dest.
download_file(file_id: str | int, dest: Path | str) -> Path
async
Stream one file to dest by its file id.
file_id is the id of an entry from :meth:files. The route
answers a redirect chain across ndownloader.figshare.com to the
storage host, which the core download follows.
version_files(id: str | int, version: int) -> list[FigshareFile]
async
List the files of one published version.
embargo(id: str | int, version: int) -> FigshareEmbargo
async
Fetch the embargo details of one published version.
confidentiality(id: str | int, version: int) -> FigshareConfidentiality
async
Fetch the confidentiality details of one published version.
bibliofabric.figshare.CollectionsResource
Client for the public /collections endpoints.
search, iterate, and collect read the POST body of
/collections/search. count() is unsupported: Figshare reports
no totals.
articles(id: str | int, filters: BaseModel | Mapping[str, Any] | None = None, *, sort: str | None = None, page: int | None = None, page_size: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[FigshareArticle]
async
List the articles of one collection, newest first.
Each entry carries the slim article shape without license;
fetch full records through the articles resource.
versions(id: str | int, *, page: int | None = None, page_size: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[FigshareCollectionVersionRef]
async
List the versions of one collection, newest first.
version(id: str | int, version: int) -> FigshareCollection
async
Fetch one published version of a collection as a full record.
bibliofabric.figshare.ProjectsResource
Client for the public /projects endpoints.
search, iterate, and collect read the POST body of
/projects/search. count() is unsupported: Figshare reports no
totals.
articles(id: str | int, filters: BaseModel | Mapping[str, Any] | None = None, *, sort: str | None = None, page: int | None = None, page_size: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[FigshareArticle]
async
List the public articles of one project, newest first.
Each entry carries the slim article shape; fetch full records through the articles resource.
bibliofabric.figshare.CategoriesResource
Client for /categories: the Figshare category taxonomy.
bibliofabric.figshare.LicensesResource
Client for /licenses: the licenses an item can carry.
bibliofabric.figshare.ItemTypesResource
Client for /item_types: the item types (figure, dataset...).
bibliofabric.figshare.AltmetricInstitutionsResource
Client for /altmetric/institutions: the Figshare portals.
bibliofabric.figshare.InstitutionsResource
Client for the public institution article filter.
GET /institutions/{institution_string_id}/articles/filter-by lists
the articles of one institution portal that carry a given resource
(resource_id, usually the publisher DOI of the collection) and a
filename. The route answers one unpaged bare array, so search()
and count() do not fit it; use :meth:filter_by.
filter_by(institution: str, *, resource_id: str, filename: str, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> list[FigshareArticle]
async
List the articles of institution filtered by resource and filename.
institution is the string id of the portal (for example
lboro); resource_id and filename are required upstream.
Models
bibliofabric.figshare.FigshareArticle
One Figshare item (article, dataset, figure, ...).
The list and search routes answer the slim shape (id through
group_id); /articles/{id} and the version detail route fill the
rest. Fields added upstream are kept through extra="allow".
bibliofabric.figshare.FigshareCollection
One Figshare collection.
The list and search routes answer the slim shape (id through
timeline); /collections/{id} and the version detail route fill
the rest. Fields added upstream are kept through extra="allow".
bibliofabric.figshare.FigshareProject
One Figshare project.
bibliofabric.figshare.FigshareFile
One file of an item; download_url points at ndownloader.
Filters and helpers
bibliofabric.figshare.ArticlesFilter
Filter model for the article routes (list and search).
bibliofabric.figshare.CollectionsFilter
Filter model for the collection routes (list and search).
bibliofabric.figshare.ProjectsFilter
Filter model for the project routes (list and search).
bibliofabric.figshare.normalize_id(value: str | int) -> str
Return the bare numeric Figshare id behind value.
Accepts the bare id (35160265), a Figshare DOI
(10.6084/m9.figshare.35160265 and the c. spelling of
collection DOIs), a doi.org URL of such a DOI, and a
figshare.com page URL whose last path segment carries the id
(https://figshare.com/articles/dataset/Phoenix/35160265). A value
that does not resolve to digits raises :class:ConfigurationError.