Skip to main content

A simple Python module that wraps the meduza.io API.

Project description

Meduza

A simple Python module that wraps the meduza.io API. (read about Meduza on Buzzfeed)

Installation

pip3 install meduza

Usage

Get an article:

>>> url = "https://meduza.io/en/brief/2018/07/16/the-real-russia-today"

>>> article = meduza.get(url)

>>> article.title
'The Real Russia. Today.'

>>> article.second_title
"Trump and Putin meet in Helsinki, the ‘Deep State’ consensus, and Pussy Riot's heart-to-heart with the police"

>>> article.description
'Ahead of the July 16 summit between Vladimir Putin and Donald Trump in Helsinki...'

# and so on:
>>> for attr in filter(lambda x: not x.startswith('_'), dir(article)):
...     print(f"article.{attr}")
article.as_dict
article.blocks
article.datetime
article.description
article.footer
article.html
article.image
article.is_blocks
article.is_html
article.reactions
article.second_title
article.source
article.tag
article.title
article.type
article.url

Read latest articles:

# English version:

>>> for article in meduza.section('news', language='en', results=3):
...     print(article)
<News: 'A good news month'>
<Like It Or Not: 'A masterclass in imprecision'>
<Like It Or Not: 'Dancy dancy McInternet dance'>


# Russian version:

>>> for article in meduza.section('news', language='ru', results=3):
...     print(article)
<Новости: 'Путина спросили про пенсионную реформу. Он ответил, что ему все не нравится'>
<Шапито: 'В Екатеринбурге открыли барельеф с «условными» Дзержинским и Сталиным (или Кагановичем)'>
<Шапито: 'Новая иллюзия: круги, раскрашенные в четыре разных цвета (на самом деле нет)'>

You can find available tags and sections in constants:

>>> meduza.EN_SECTIONS
'news'

>>> meduza.EN_TAGS
('news', 'like it or not', 'games')

>>> meduza.RU_SECTIONS
('news', 'articles', 'shapito', 'razbor', 'games', 'podcasts')

>>> meduza.RU_TAGS
('новости', 'истории', 'разбор', 'шапито', 'игры', 'подкасты', 'партнерский материал')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meduza-18.7.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

meduza-18.7-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file meduza-18.7.tar.gz.

File metadata

  • Download URL: meduza-18.7.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for meduza-18.7.tar.gz
Algorithm Hash digest
SHA256 c4e235aa395e324c127aeb9efa33c4ae49ccbfd5d2d78b357ff53620ee8b4b76
MD5 e418d57c476ed71702615b9fe3b8d5a0
BLAKE2b-256 b7a0afd20d010b3cb60c80241189b449fa39ce46e3353345ded7c53051afef64

See more details on using hashes here.

File details

Details for the file meduza-18.7-py3-none-any.whl.

File metadata

File hashes

Hashes for meduza-18.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a4f6f2b4d9d7d81299faddf3c0e69953138e879e212285ca1c18dc1c042a5bc5
MD5 3acd056e91cd837df068502aabd5d643
BLAKE2b-256 fb7e7b0005049ed2e46f670f87ad7f94e2795ef127b2f599ef2191f271c0573b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page