CrossRefOrcid.update_references¶
- CrossRefOrcid.update_references(orcid_id, work_types=None, recent_years=2, style='APA', file_path='tests/README.md', heading='Recent publications', heading_level=3, heading_suffix=':', max_entries=100, confirmation_required=True, verbose=False, raise_error=False)[source]¶
Orchestrates the fetching and writing of references to a Markdown file.
- Parameters:
orcid_id (str) – ORCID iD of the researcher.
work_types (str | list | None) – Work type(s) to include; defaults to
None.recent_years (int) – Number of recent years to include; defaults to
2.style (str) – The citation style to use; defaults to
'APA'.file_path (str | os.PathLike) – Path to the Markdown file; defaults to
"README.md".heading_level (int) – The level of the heading under which the contents are to be updated; defaults to
3.heading (str) – The Markdown heading for the references section; defaults to
"Recent publications".heading_suffix (str | None) – Suffix to the
heading; defaults to":".max_entries (int | None) – The maximum number of references to be included; defaults to
100.confirmation_required (bool) – Whether to prompt for confirmation before proceeding; defaults to
True.verbose (bool) – If
True, prints status messages; defaults toFalse.raise_error (bool) – Whether to raise the provided exception; if
raise_error=False(default), the error will be suppressed.
Examples:
>>> from pyhelpers.ops import CrossRefOrcid >>> import os >>> co = CrossRefOrcid() >>> orcid_id = '0000-0002-6502-9934' >>> co.update_references(orcid_id, verbose=True) To write references in "./tests/README.md" ? [No]|Yes: yes Writing "Recent publications" in "./tests/README.md" ... Done. >>> co.update_references(orcid_id, recent_years=5, max_entries=5, verbose=True) To update references in "./tests/README.md" ? [No]|Yes: yes Updating "Recent publications" in "./tests/README.md" ... Done. >>> os.remove("./tests/README.md")