def news(message): url_out = meduza.latest_push()['url'] title_out = meduza.get(url_out)['title'] bot.send_message(message.chat.id, '{a} \n {b}'.format(a=title_out, b=url_out))
import meduza url = "https://meduza.io/en/brief/" article = meduza.get(url) for article in meduza.section('news', n=10, lang='ru'): print(f" - '{article['title']}'")
def test_get_from_url_with_api_suffix(): url = f"{meduza._BASEURL}/{meduza._W5}/{ARTICLE_RELATIVE_URL}" article = meduza.get(url) assert "title" in article assert url.endswith(article["url"])
def test_get_from_relative_url(): article = meduza.get(ARTICLE_RELATIVE_URL) assert "title" in article assert ARTICLE_RELATIVE_URL.endswith(article["url"])
def test_get_from_full_url(): url = f"{meduza._BASEURL}/{ARTICLE_RELATIVE_URL}" article = meduza.get(url) assert "title" in article assert url.endswith(article["url"])