Skip to main content

API and terminal-based CLI for Raindrop.io bookmark manager

Project description

RaindropPY

MIT License Python Version pre-commit

Python wrapper for the Raindrop.io Bookmark Manager API as well as a simple command-line interface to prove out the API.

Background & Acknowledgments

I needed a few additions to an existing API for the Raindrop Bookmark Manager and desired a simple terminal-based UI for interactive work with Raindrop itself. Thus, this is a fork of python-raindropio from Atsuo Ishimoto...thanks Atsuo!

Status

As the API layer is based on a fork of an existing package, it's reasonably stable (as of this writing, only one minor enhancement is envisioned)

However, the command-line interface (CLI) is brand new and lacking tests. Thus, it's probably NOT ready for serious use yet.

Requirements

Requires Python 3.10 or later (well, at least I'm developing against 3.10.9).

Install

[.venv] pip install raindroppy

or (albeit untested):

[.venv] poetry add raindroppy

Setup

To use this package, besides your own account on Raindrop, you'll need to create an integration app on the Raindrop.io site from which you can create API token(s).

  • Go to app.draindrop.api/settings/integrations and select + create new app.

  • Give it a descriptive name and then select the app you just created.

  • Select Create test token and copy the token provided. Note that the basis for calling it a "test" token is that it only gives you access to bookmarks within your own account. Raindrop allows you to use their API against other people's environments using oAuth (see untested/unsupported flask_oauth file in /examples)

  • Save your token into your environment (we use python-dotenv so a simple .env/.envrc file your information should suffice), for example:

# in a .env file:
RAINDROP_TOKEN=01234567890-abcdefghf-aSample-API-Token-01234567890-abcdefghf

# or for bash:
export RAINDROP_TOKEN=01234567890-abcdefghf-aSample-API-Token-01234567890-abcdefghf

# or go fish:
set -gx RAINDROP_TOKEN 01234567890-abcdefghf-aSample-API-Token-01234567890-abcdefghf

# ...

API Usage & Examples

A full suite of examples are provided in the examples directory, here are a few to give you some idea of the usage model:

Create a New Raindrop Bookmark to a URL

import os
import sys

from dotenv import load_dotenv

from raindroppy.api import API, Raindrop

load_dotenv()

with API(os.environ["RAINDROP_TEST_OKEN"]) as api:
    link, title = "https://www.python.org/", "Our Benevolent Dictator's Creation"
    print(f"Creating Raindrop to: '{link}' with title: '{title}'...", flush=True, end="")
    raindrop = Raindrop.create_link(api, link=link, title=title, tags=["abc", "def"])
    print(f"Done, id={raindrop.id}")

Create a New Raindrop Collection

import os
import sys
from datetime import datetime
from getpass import getuser

from dotenv import load_dotenv

from raindroppy.api import API, Collection

load_dotenv()

with API(os.environ["RAINDROP_TOKEN"]) as api:
    title = f"TEST Collection ({getuser()}@{datetime.now():%Y-%m-%dT%H:%M:%S})"
    print(f"Creating collection: '{title}'...", flush=True, end="")
    collection = Collection.create(api, title=title)
    print(f"Done, {collection.id=}.")

Display All Bookmarks from the Unsorted Raindrop Collection

import os
from dotenv import load_dotenv

from raindroppy.api import API, CollectionRef, Raindrop

load_dotenv()


with API(os.environ["RAINDROP_TOKEN"]) as api:
    page = 0
    while (items := Raindrop.search(api, collection=CollectionRef.Unsorted, page=page)):
        for item in items:
            print(item.title)
        page += 1

Command-Line Interface Usage

# Remember to setup RAINDROP_TOKEN in your environment!
[.venv] % raindroppy

Acknowledgments

License

Copyright (c) 2022 Peter Borocz. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raindrop_io_py-0.0.1.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raindrop_io_py-0.0.1-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file raindrop_io_py-0.0.1.tar.gz.

File metadata

  • Download URL: raindrop_io_py-0.0.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.2.0

File hashes

Hashes for raindrop_io_py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9b835eff6ccb00097f71e26dff7925a334e0a3e159e5a0199dbde231b5cd4a04
MD5 e1e09d75cb1607f9d2e9e5c6f33107c0
BLAKE2b-256 0b58282d75280d3b789d7fc5c44bb6451057ad636d06a2c6e95f1fcf7dec84cf

See more details on using hashes here.

File details

Details for the file raindrop_io_py-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: raindrop_io_py-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.2.0

File hashes

Hashes for raindrop_io_py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b580035d3c984dbfd8f9d5edd18e256e03bf3350bc1f32e229b7cafd5e41189f
MD5 3502b5ddb55afec557cc37c4cf12fa3d
BLAKE2b-256 f71bc64466dc31d7b2cbc226b7c8abb1b4ca82b3596826063e66a6546343a5ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page