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', n=3, lang='en'):
... 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', n=3, lang='ru'):
... 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
Release history Release notifications | RSS feed
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.10.5.tar.gz
(5.0 kB
view details)
File details
Details for the file meduza-18.10.5.tar.gz
.
File metadata
- Download URL: meduza-18.10.5.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64cf1ed574e1040fba73ee1a8adea486b4fb082e5133e1aaedc8be0f259a320d |
|
MD5 | 0dec9f435afd3e9744dfce1b97869af9 |
|
BLAKE2b-256 | 82a78abc249dfcab2c95582984dc39c5ed6bdad45b8ac729141bda54d4a551d5 |