A library for getting quotes from the Forismatic API. Supports asynchronous syntax. Библиотека для получения цитат из Forismatic API. Поддерживает асинхронный синтаксис.
Project description
Forismatic
An unoficall library for getting quotes from the Forismatic API. Supports asynchronous syntax.
Неофицальная библиотека для получения цитат из Forismatic API. Поддерживает асинхронный синтаксис.
Installing || Установка
pip3 install asyncforismatic
Requires aiohttp and requests
Examples || Примеры
import asyncforismatic
import asyncio
# getting sync quote on russian as dict
# синхронное получение цитаты на русском в виде словаря
print(asyncforismatic.quote(lang='ru', as_dict=True))
# getting async quote with default params (english language and formated quote)
# асинхронное получение цитаты со стандартными параметрами (английский язык и отформатированная цитата)
async def example():
return await asyncforismatic.asyncforismatic()
print(asyncio.run(example()))
Methods || Методы
Getting a quote (async) || Получение цитаты (асинхронно)
corotinue asyncforismatic(lang='en', *, as_dict=False)
- Returns an quote from Forismatic API
- Возвращает цитату из Forismatic API
Parameters || Параметры
as_dict: bool
- If True, quote returns as JSON-like object (dict)
- Если True, возвращает результат в JSON'о подобном формате (dict, словарь)
Raises exceptions || Поднимает исключения
TypeError
- The language is not passed as 'str'
- Язык передан не как 'str'
LangIsNotSupported
- The language is not supported
- Язык не поддерживается
Returns Union[str, dict]
ВозвращаетUnion[str, dict]
Getting a quote || Получение цитаты
def quote(lang='en', *, as_dict=False)
- Returns an quote from Forismatic API
- Возвращает цитату из Forismatic API
Parameters || Параметры
as_dict: bool
- If True, quote returns as JSON-like object (dict)
- Если True, возвращает результат в JSON'о подобном формате (dict, словарь)
Raises exceptions || Поднимает исключения
TypeError
- The language is not passed as 'str'
- Язык передан не как 'str'
LangIsNotSupported
- The language is not supported
- Язык не поддерживается
Returns Union[str, dict]
Возвращает Union[str, dict]
Exceptions || Исключения
LangIsNotSupported
- Raises when the language is not supported
- Возникает когда язык не поддерживается
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
asyncforismatic-0.0.1.tar.gz
(3.8 kB
view hashes)