QuickstartΒΆ
Snip is distributed on PyPI. To use the package:
Install the package using pip:
pip install snip-python
Use the
snipcommand line interface (CLI) to interact with your lab books. For example, you can use thesnip tokencommand to store and retrieve your API tokens.
snip token --help
Create and upload snippets to your lab books programmatically using the Python API.
from snip.snippets import ImageSnip
snip = ImageSnip.from_path("path/to/image.png", book_id="[YOUR_BOOK_ID]")
# show a preview of the snippet
snip.preview()
If you need help figuring out where to find the book id, please have a look here.
# upload the snippet
snip.upload()
The upload will automatically search your tokens in the keyring or in the configuration file and use the correct token to upload the snippet.