Skip to content

Benature/OmnivoreAPI

 
 

Repository files navigation

OmnivoreAPI: Omnivore API client for Python

中文 | English

Forked from OmnivoreQL

This is a Python client for the Omnivore API.

PyPI version

Installation

pip install omnivore_api

CLI

After installation, the omnivore command is available directly in your terminal.

Setup

omnivore init

Prompts for your API token and endpoint URL, then writes ~/.config/omnivore-api/config.yaml.

Commands

# Save a URL (optionally with labels)
omnivore save-url https://example.com
omnivore save-url https://example.com --label reading --label python

# List articles in your inbox
omnivore get-articles
omnivore get-articles --limit 20 --query "in:inbox" --format markdown

# Get your profile
omnivore get-profile

# List all labels
omnivore get-labels

All commands output JSON to stdout, so you can pipe to jq:

omnivore get-labels | jq '.[].name'

Python API

Import the package and create a client instance:

from omnivore_api import OmnivoreAPI

omnivore = OmnivoreAPI("your_api_token_here", "your_api_url_here")
profile = omnivore.get_profile()

saved_page = omnivore.save_url("https://www.google.com")
saved_page_with_label = omnivore.save_url("https://www.google.com", ["label1", "label2"])

articles = omnivore.get_articles()

username = profile['me']['profile']['username']
slug = articles['search']['edges'][0]['node']['slug']
article = omnivore.get_article(username, slug)

subscriptions = omnivore.get_subscriptions()

labels = omnivore.get_labels()
from omnivore_api import CreateLabelInput
omnivore.create_label(CreateLabelInput("label1", "#00ff00", "This is label description"))

Documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

@omnivore-app API client for Python

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 62.6%
  • Jupyter Notebook 37.4%