Skip to content

Commit ea14a3a

Browse files
committed
docs(python): update README and export parse_url functions
- Export parse_url and parse_url_with_limits in __init__.py - Update README with URL fetching documentation - Remove outdated 'URL fetching not implemented' note - Add HTTP fetching and Conditional GET to features - Fix repository URLs (rabax -> bug-ops)
1 parent 36637a9 commit ea14a3a

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

crates/feedparser-rs-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2024"
55
rust-version = "1.85"
66
license = "MIT OR Apache-2.0"
77
description = "High-performance RSS/Atom/JSON Feed parser for Python (drop-in feedparser replacement)"
8-
repository = "https://github.com/rabax/feedparser-rs"
8+
repository = "https://github.com/bug-ops/feedparser-rs"
99
keywords = ["rss", "atom", "feed", "parser", "python"]
1010
categories = ["parsing", "web-programming"]
1111
publish = false # Published via maturin to PyPI

crates/feedparser-rs-py/README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# feedparser-rs
22

3+
[![PyPI](https://img.shields.io/pypi/v/feedparser-rs)](https://pypi.org/project/feedparser-rs/)
4+
[![Python](https://img.shields.io/pypi/pyversions/feedparser-rs)](https://pypi.org/project/feedparser-rs/)
5+
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue)](LICENSE-MIT)
6+
37
High-performance RSS/Atom/JSON Feed parser for Python with feedparser-compatible API.
48

59
## Features
610

711
- **Fast**: Native Rust implementation via PyO3
12+
- **HTTP fetching**: Built-in URL fetching with compression (gzip, deflate, brotli)
13+
- **Conditional GET**: ETag/Last-Modified support for efficient polling
814
- **Tolerant parsing**: Bozo flag for graceful handling of malformed feeds
915
- **Multi-format**: RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
1016
- **Podcast support**: iTunes and Podcast 2.0 namespace extensions
@@ -19,6 +25,8 @@ pip install feedparser-rs
1925

2026
## Usage
2127

28+
### Basic Parsing
29+
2230
```python
2331
import feedparser_rs
2432

@@ -36,6 +44,24 @@ for entry in d.entries:
3644
print(entry.published_parsed) # time.struct_time
3745
```
3846

47+
### Fetching from URL
48+
49+
```python
50+
import feedparser_rs
51+
52+
# Fetch and parse in one call
53+
d = feedparser_rs.parse_url('https://example.com/feed.xml')
54+
55+
print(d.feed.title)
56+
print(f"Fetched {len(d.entries)} entries")
57+
58+
# With custom limits
59+
limits = feedparser_rs.ParserLimits(max_entries=100)
60+
d = feedparser_rs.parse_url_with_limits('https://example.com/feed.xml', limits)
61+
```
62+
63+
> **Note**: `parse_url` supports automatic compression (gzip, deflate, brotli) and follows redirects.
64+
3965
## Migration from feedparser
4066

4167
```python
@@ -46,9 +72,10 @@ d = feedparser.parse(feed_content)
4672
# Option 2: direct import
4773
import feedparser_rs
4874
d = feedparser_rs.parse(feed_content)
49-
```
5075

51-
> **Note**: URL fetching is not yet implemented. Use `requests.get(url).content` to fetch feeds.
76+
# Option 3: URL fetching (new!)
77+
d = feedparser_rs.parse_url('https://example.com/feed.xml')
78+
```
5279

5380
## Advanced Usage
5481

@@ -99,7 +126,9 @@ for entry in d.entries:
99126
### Functions
100127

101128
- `parse(source)` — Parse feed from bytes or str
129+
- `parse_url(url)` — Fetch and parse feed from URL
102130
- `parse_with_limits(source, limits)` — Parse with custom resource limits
131+
- `parse_url_with_limits(url, limits)` — Fetch and parse with custom limits
103132
- `detect_format(source)` — Detect feed format without full parsing
104133

105134
### Classes
@@ -134,4 +163,5 @@ MIT OR Apache-2.0
134163

135164
- [GitHub](https://github.com/bug-ops/feedparser-rs)
136165
- [PyPI](https://pypi.org/project/feedparser-rs/)
166+
- [Documentation](https://github.com/bug-ops/feedparser-rs#python)
137167
- [Issues](https://github.com/bug-ops/feedparser-rs/issues)

crates/feedparser-rs-py/python/feedparser_rs/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
>>> print(d.feed.title)
1111
>>> print(d.entries[0].published_parsed)
1212
13-
For full documentation, see: https://github.com/rabax/feedparser-rs
13+
For full documentation, see: https://github.com/bug-ops/feedparser-rs
1414
"""
1515

1616
from ._feedparser_rs import (
@@ -19,11 +19,15 @@
1919
__version__,
2020
detect_format,
2121
parse,
22+
parse_url,
23+
parse_url_with_limits,
2224
parse_with_limits,
2325
)
2426

2527
__all__ = [
2628
"parse",
29+
"parse_url",
30+
"parse_url_with_limits",
2731
"parse_with_limits",
2832
"detect_format",
2933
"FeedParserDict",

0 commit comments

Comments
 (0)