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"))
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"))
def get_monthstat_data(YYYYmm: str) -> flask.Response: data = yearmonth.monthly_statistics(YYYYmm) return make_json_response(data.to_dict())
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)
def get_unscraped_urls() -> flask.Response: unscraped_urls = service.get_unscraped_urls() return make_json_response(unscraped_urls)
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())