Skip to content

Commit 40026fc

Browse files
committed
feat: Migrate from httpx to httpx2
1 parent 37bf0a2 commit 40026fc

6 files changed

Lines changed: 18 additions & 10 deletions

File tree

example/config/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
1515

1616
application = get_asgi_application()

example/config/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
1515

1616
application = get_wsgi_application()

justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
test:
2+
uv run pytest
3+
4+
format:
5+
uv run ruff format .
6+
7+
check:
8+
uv run ruff check . && uv run mypy .

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "django-rss-filter"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
description = "Filter public RSS feeds, remove articles that contain certain keywords or categories."
55
authors = [
66
{name = "Kevin Renskers", email = "kevin@loopwerk.io"},
@@ -13,7 +13,7 @@ dependencies = [
1313
"django>=4.2.0",
1414
"feedgen>=1.0.0",
1515
"feedparser>=6.0.11",
16-
"httpx>=0.28.1",
16+
"httpx2>=2.2.0",
1717
]
1818
keywords = ["rss", "atom", "feed", "filter", "mute", "django"]
1919
classifiers = [

rssfilter/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import uuid
22
from datetime import timedelta
33

4-
import httpx
4+
import httpx2
55
from django.core.exceptions import ValidationError
66
from django.db import models
77
from django.urls import reverse
88
from django.utils import timezone
9-
from httpx import ConnectError, ConnectTimeout, ReadTimeout
9+
from httpx2 import ConnectError, ConnectTimeout, ReadTimeout
1010

1111
from . import USER_AGENT
1212
from .settings import RSS_FILTER_CACHE_SECONDS
@@ -76,7 +76,7 @@ def get_feed_body(self) -> str:
7676
return self.feed_body
7777

7878
try:
79-
r = httpx.get(self.feed_url, follow_redirects=True, timeout=2, headers={"User-Agent": USER_AGENT})
79+
r = httpx2.get(self.feed_url, follow_redirects=True, timeout=2, headers={"User-Agent": USER_AGENT})
8080
self.feed_body = r.text
8181
self.cache_date = timezone.now()
8282
self.save()

rssfilter/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
from typing import Literal
33

44
import feedparser
5-
import httpx
5+
import httpx2
66
from feedgen.feed import FeedGenerator
77
from feedparser import FeedParserDict
8-
from httpx import ConnectError, ConnectTimeout
8+
from httpx2 import ConnectError, ConnectTimeout
99

1010
from . import USER_AGENT
1111

@@ -28,7 +28,7 @@ def validate_feed(feed_url: str) -> FeedValidationSuccess | FeedValidationError:
2828
# since we can't set a timeout with feedparser. It also makes sure
2929
# that validating and then fetching the feed is done in a consistent
3030
# manner.
31-
r = httpx.get(feed_url, follow_redirects=True, timeout=2, headers={"User-Agent": USER_AGENT})
31+
r = httpx2.get(feed_url, follow_redirects=True, timeout=2, headers={"User-Agent": USER_AGENT})
3232
feed = validate_feed_body(r.text)
3333
if not feed:
3434
return FeedValidationError(False, "This doesn't seem to be a valid RSS or Atom feed")

0 commit comments

Comments
 (0)