Skip to content

Commit

Permalink
Include all data from constants in downloaded feed metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse committed Jul 28, 2023
1 parent 2c17061 commit 617dd35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions tests/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@


async def run_feed(feed: dict) -> None:
"""Download feed."""
"""Download feed and store its metadata and content."""
async with aiohttp.ClientSession() as session:
async with session.get(feed["url"]) as response:
text = await response.text()
metadata = {
"name": feed["name"],
"url": feed["url"],
"download_date": base_date.isoformat(),
}
metadata = feed
metadata["download_date"] = base_date.isoformat()
file = Path(__file__).parent / f'data/{feed["name"]}.json'
file.write_text(json.dumps(metadata, indent=4))
file = Path(__file__).parent / f"data/{feed['name']}.xml"
Expand Down
2 changes: 1 addition & 1 deletion tests/feedsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def download_date(self: "FeedSource") -> datetime:
@property
def has_images(self: "FeedSource") -> bool:
"""Return has_images."""
return self.raw.get("has_images", False)
return self.metadata.get("has_images", False)

@property
def date_format(self: "FeedSource") -> str:
Expand Down

0 comments on commit 617dd35

Please sign in to comment.