Skip to content

Commit

Permalink
refactor: limit should be passed to itunes.search()
Browse files Browse the repository at this point in the history
  • Loading branch information
danjac committed Aug 29, 2024
1 parent 8db9151 commit 5a834d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 1 addition & 6 deletions radiofeed/podcasts/itunes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from collections.abc import Iterator

import httpx
from django.conf import settings

from radiofeed.http_client import Client
from radiofeed.podcasts.models import Podcast
Expand All @@ -28,11 +27,7 @@ class Feed:
podcast: Podcast | None = None


def search(
client: Client,
search_term: str,
limit: int = settings.PAGE_SIZE,
) -> Iterator[Feed]:
def search(client: Client, search_term: str, limit: int) -> Iterator[Feed]:
"""Search iTunes podcast API."""
return _insert_podcasts(
_parse_feeds_from_json(
Expand Down
6 changes: 5 additions & 1 deletion radiofeed/podcasts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def search_itunes(request: HttpRequest) -> HttpResponseRedirect | TemplateRespon
discover_url = reverse("podcasts:discover")

if request.search:
feeds = itunes.search(get_client(), request.search.value)
feeds = itunes.search(
get_client(),
request.search.value,
settings.PAGE_SIZE,
)

return TemplateResponse(
request,
Expand Down

0 comments on commit 5a834d9

Please sign in to comment.