unofficial API client for lobste.rs
Project description
lobstr
lobstr is an unofficial async-first object-oriented api wrapper for lobste.rs.
the library only supports GET requests or read operations.
It plans to support the following objects
- feeds (homepage, newest, by tags, etc)
- stories (the post + comments)
- comments (info about a singular comment)
- tags (info regarding a tag, list of all tags)
- search (search for stories, comments, users)
Table of Contents
Features
- Async-first API built on
httpx - Fully typed Pydantic models
- Well-documented sdk with docstrings
Installation
Requires Python 3.10 or higher.
pip
pip install lobstr
uv
uv add lobstr
Poetry
poetry add lobstr
Pipenv
pipenv install lobstr
Quick Start
Fetch a Story
import asyncio
from lobstr import Lobster
async def main():
async with Lobster() as lob:
story = await lob.story(short_id="ishgbs")
print(story.title) # title of the story
print(story.username) # author's username
print(story.article_url) # article attached to the story
asyncio.run(main())
Fetch Hottest Stories
import asyncio
from lobstr import Lobster
async def main():
async with Lobster() as lob:
stories = await lob.feeds.hot()
for story in stories[:5]: # print the top 5 hottest stories
print(story.title) # title of the story
print(story.username) # author's username
print(story.article_url) # article attached to the story
asyncio.run(main())
Documentation
Complete documentation, API reference, guides, and examples are available at:
https://kavin81.github.io/lobstr
For lobste.rs API documentation, API_SPEC.md.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lobstr-0.5.0.tar.gz.
File metadata
- Download URL: lobstr-0.5.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f893550e1360114db0f736a4a8ee5c52939aa9cbb3d6b097d204c1adacd6334e
|
|
| MD5 |
206fcfac60f94e4bc20e9c3367f4f698
|
|
| BLAKE2b-256 |
fd44d9ed7e83bb4110967ba2f7a66fe13698ff1ac995fd5eb47c3376cecd76e8
|
File details
Details for the file lobstr-0.5.0-py3-none-any.whl.
File metadata
- Download URL: lobstr-0.5.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfd384a8786b9292a08b5cddc7fe212486e672d05ea223c28d02011986358f8e
|
|
| MD5 |
2d0664c35b0001676054bc678e617dbc
|
|
| BLAKE2b-256 |
5feeedebf6944de7f9ec69f2bfc6499782d0bf7ea3dcfe5b4c8a2846c53d9606
|