API documentation#

class pygscholar.Author(*, info: AuthorInfo, publications: Sequence[Publication] = ())[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pygscholar.AuthorInfo(*, name: str, scholar_id: str, link: str = '', affiliation: str = '', email: str = '', cited_by: int = 0, data: dict[str, ~typing.Any] = <factory>)[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pygscholar.Department(*, authors: list[Author])[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pygscholar.Publication(*, title: str, year: int = 0, num_citations: int = 0, abstract: str = '', authors: str = '', journal: str = '', volume: str = '', issue: str = '', pages: str = '', publisher: str = '', pdf_url: str = '', scholar_url: str = '', date: str = '')[source]#
model_config: ClassVar[ConfigDict] = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

author#

class pygscholar.author.Author(*, info: AuthorInfo, publications: Sequence[Publication] = ())[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pygscholar.author.AuthorInfo(*, name: str, scholar_id: str, link: str = '', affiliation: str = '', email: str = '', cited_by: int = 0, data: dict[str, ~typing.Any] = <factory>)[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cli#

Command line interface for pygscholar. You can also set the environment variable PYSCHOLAR_CACHE_DIR to change the default cache directory.

pygscholar.cli.license_callback(show_license: bool)[source]#

Prints license information.

pygscholar.cli.version_callback(show_version: bool)[source]#

Prints version information.

department#

class pygscholar.department.Department(*, authors: list[Author])[source]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

publication#

class pygscholar.publication.Publication(*, title: str, year: int = 0, num_citations: int = 0, abstract: str = '', authors: str = '', journal: str = '', volume: str = '', issue: str = '', pages: str = '', publisher: str = '', pdf_url: str = '', scholar_url: str = '', date: str = '')[source]#
model_config: ClassVar[ConfigDict] = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

api#

class pygscholar.api.LocalNavigator(_dbname: 'Path | str | None')[source]#
class pygscholar.api.scraper.NavigatorType(*args, **kwargs)[source]#
pygscholar.api.scraper.author_info_from_id(scholar_id: str, driver: NavigatorType | None = None) AuthorInfo[source]#

Build the author info from the profile page alone.

Searching for an author is unreliable (see search_author), so whenever we already know the scholar id we skip the search entirely.

pygscholar.api.scraper.get_driver(driver: NavigatorType | None = None) NavigatorType[source]#

Use the recorded pages in LOCAL_DBPATH if it is set, otherwise go online.

pygscholar.api.scraper.name_variants(name: str) list[str][source]#

Query variants to look for, in decreasing order of precision.

Google only shows the user profile panel for some queries. A full name such as “Henrik Nicolay Finsberg” gives no panel at all, while “Henrik Finsberg” does, so fall back to the first and the last name.

pygscholar.api.scraper.parse_author_panel(parser: LexborHTMLParser) list[AuthorInfo][source]#

Parse the ‘User profiles’ panel of a search result page.

cache#

config#