Skip to content

Commit

Permalink
docs(mediacloud.py): comment and check about mediacloud bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpomerenke committed Mar 14, 2024
1 parent 9f87e3e commit 9c3a0b8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import mediacloud.api
import pandas as pd
from dotenv import load_dotenv
from media_impact_monitor.util.cache import cloudcache

load_dotenv()

Expand All @@ -19,13 +18,13 @@
Platform = Literal["onlinenews-mediacloud", "onlinenews-waybackmachine"]


@cloudcache
def get_mediacloud_counts(
query: str,
start_date: pd.Timestamp = start,
end_date: pd.Timestamp = end,
countries: list | None = None,
):
assert len(countries) == 1, "Currently only supports one country at a time."
collection_ids: list[str] = []
if countries:
collection_ids = []
Expand All @@ -39,6 +38,7 @@ def get_mediacloud_counts(
query=query,
start_date=start_date.to_pydatetime().date(),
end_date=end_date.to_pydatetime().date(),
# There seems to be a bug in the library relating to `collection_ids`:
collection_ids=collection_ids,
)
df = pd.DataFrame(data)
Expand Down

0 comments on commit 9c3a0b8

Please sign in to comment.