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
pip 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"
Get the latest articles on this section:
# English version:
>>> for article in meduza.section('news', n=3, lang='en'):
... print(f" - '{article['title']}'")
- 'Chechnya’s ruler has a stable full of prize-winning race horses, but you’d never know it, looking at his income declarations'
- 'Russian musicians are being forced to cancel their concerts across the country, which makes now the perfect time to listen to their music'
- 'The Real Russia. Today.'
# Russian version:
>>> for article in meduza.section('news', n=3, lang='ru'):
... print(f" - '{article['title']}'")
- 'Путина спросили про пенсионную реформу. Он ответил, что ему все не нравится'
- 'В Екатеринбурге открыли барельеф с «условными» Дзержинским и Сталиным (или Кагановичем)'
- 'Новая иллюзия: круги, раскрашенные в четыре разных цвета (на самом деле нет)'
Search articles by key words:
# English version:
>>> for article in meduza.search('Indigenous', n=3, lang='en'):
... print(f" - '{article['title']}'")
- 'Indigenous scholar commits self-immolation in Ural city to protest language death'
- '‘This is the land of our ancestors’'
- 'Trial by fire'
# Russian version:
>>> for article in meduza.search('языка коренного', n=3, lang='ru'):
... print(f" - '{article['title']}'")
- 'Острова Кука собрались сменить название'
- 'Последний аргумент в длинном споре'
- 'При пожаре в Национальном музее Бразилии погиб архив языков коренных народов. Некоторые из них больше никто не знает'
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-20.7.2.tar.gz
(4.5 kB
view details)
File details
Details for the file meduza-20.7.2.tar.gz
.
File metadata
- Download URL: meduza-20.7.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87652167a80c22b8864cdbaa7b63d9f731ed683ec16105fd5f7f57151d856bfe |
|
MD5 | ec81e3ac1f01f2966c1805161df1862b |
|
BLAKE2b-256 | f38c74fbd754c670810641a47be828019ba32f1b9649720db5f479dac90c0e23 |