zotero_tools¶
Programmatic access to Zotero libraries.
- documentation of pyzotero: https://pyzotero.readthedocs.io
- API key: https://www.zotero.org/settings/keys/new
- group id: open the page of the group via https://www.zotero.org/groups and
hover over the link to the group settings, the id is the integer after
/groups/.
create_zot_client
¶
Create a Zotero client bound to a library.
The item methods of the client only operate on this library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
Zotero API key with read access to the library. |
required |
library_id
|
int
|
id of the user or group library. |
required |
library_type
|
str
|
|
'group'
|
Returns:
| Type | Description |
|---|---|
Zotero
|
The client. |
get_items
¶
Get the top level items of the library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zot
|
Zotero
|
client of the library, see |
required |
show
|
bool
|
print the items to the console. |
False
|
limit
|
int | None
|
maximal number of items; all items if |
None
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
The items as returned by the Zotero API. |
pmid_from_extra
¶
Get the PubMed id from the extra field of a Zotero item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extra
|
str | None
|
|
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The PubMed id or |
create_tag_table
¶
Create a table of the items with the selected tags.
A tag is selected if it is in tags_set or starts with one of the
tag_prefixes. Every selected tag is a boolean column, which is True for
the items with the tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Iterable[dict[str, Any]]
|
items of a library, see |
required |
tags_set
|
Iterable[str]
|
tags to select. |
required |
tag_prefixes
|
Iterable[str]
|
prefixes of the tags to select, e.g., |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The table with the columns |
DataFrame
|
selected tag. |