Exemplo n.º 1
0
def post_monthstat_data() -> flask.Response:
    data = get_required_data_from_request("yearmonth", "article_count",
                                          "word_mean", "word_median")
    dto = MonthStatsDTO.fromdict(data)
    yearmonth.create_monthstat_record(dto)
    return make_json_response(
        dict(message="Monthstat record successfully added"))
Exemplo n.º 2
0
def update_monthstat_data(YYYYmm: str) -> flask.Response:
    data = get_required_data_from_request(
        "article_count",
        "word_mean",
        "word_median",
    )
    dto = MonthStatsDTO.fromdict(dict(yearmonth=YYYYmm, **data))
    yearmonth.update_monthstat_record(dto)
    return make_json_response(
        dict(message="Monthstat record successfully updated"))
Exemplo n.º 3
0
def get_monthstat_data(YYYYmm: str) -> flask.Response:
    data = yearmonth.monthly_statistics(YYYYmm)
    return make_json_response(data.to_dict())
Exemplo n.º 4
0
def get_urls_by_yearmonth(yearmonth: str) -> flask.Response:
    url_list: List[UrlDTO] = service.get_urls_by_yearmonth(yearmonth)
    return make_json_response(url_list)
Exemplo n.º 5
0
def get_unscraped_urls() -> flask.Response:
    unscraped_urls = service.get_unscraped_urls()
    return make_json_response(unscraped_urls)
Exemplo n.º 6
0
def get_url_by_id(id: str) -> flask.Response:
    url_dto: UrlDTO = service.get_url_by_id(id)
    return make_json_response(url_dto.todict())