pyserpZotero Module¶
The pyserpZotero module is the core of the package, facilitating search and management operations through Zotero and serpAPI.
- class pyserpZotero.Colors¶
Bases:
object- BLUE = '\x1b[94m'¶
- BOLD = '\x1b[1m'¶
- CYAN = '\x1b[96m'¶
- ENDC = '\x1b[0m'¶
- GREEN = '\x1b[92m'¶
- HEADER = '\x1b[95m'¶
- RED = '\x1b[91m'¶
- UNDERLINE = '\x1b[4m'¶
- YELLOW = '\x1b[93m'¶
- class pyserpZotero.SerpZot(serp_api_key='', zot_id='', zot_key='', download_dest='.', enable_pdf_download=True)¶
Bases:
objectInitialize a SerpZot instance for managing Zotero citations and PDF downloads.
Parameters: - serp_api_key (str): API key for SerpAPI to perform searches. - zot_id (str): Zotero user/library ID for citation management. - zot_key (str): API key for accessing Zotero services. - download_dest (str): Default directory for downloading PDFs. - enable_pdf_download (bool): Flag to enable or disable automatic PDF downloads.
- Search2Zotero(query, FIELD='title')¶
Convert search results to Zotero citations, avoiding duplicates, and optionally download PDFs.
Parameters: - FIELD (str): The field of the search result to use, default is ‘title’.
Returns: - (int): Status code indicating the operation’s success (0) or failure.
- SearchScholar(term='', min_year='', save_bib=False)¶
Search Google Scholar for articles matching the specified criteria and update Zotero library.
Parameters: - term (str): The search term or query. - min_year (str): The earliest publication year for articles. - save_bib (bool): Whether to save the search results as a BibTeX file.
Returns: - (int): Status code indicating success (0) or failure (non-zero).
- attempt_pdf_download(items, full_lib=False)¶
Attempt to download a PDF for a specified DOI and attach it to a Zotero item.
Parameters: - items: Collection of Zotero items to consider for download. - full_lib (bool): Flag to indicate whether to search the entire library.
Returns: - (bool): 0 after all downloads are done
- processBibsAndUpload(doiSet, zot, items, FIELD, citation)¶
This function will download pdfs and citations related to all DOIs present in the DOI set. It will also upload the results to Zotero
Parameters: - doiSet (set): The set of DOIs. - zot (Zotero Object): The place to upload the relevant findings. - items (list): List of all present items in Zotero. - citation (Boolean): Whether to create citation (True) or to download (False).
Returns: - (int): Status code indicating success (0) or failure (non-zero).
- pyserpZotero.main()¶