pip install russian-quotes
- Sync
from russian_quotes import get_quote
text, author = get_quote()
print(f'Text: {text} Author: {author}')
- Async
import asyncio
from russian_quotes import get_quote_coro
async def main():
return await get_quote_coro()
text, author = asyncio.run(main())
print(f'Text: {text} Author: {author}')
- Catch exception
import russian_quotes
try:
text, author = russian_quotes.get_quote()
print(text, author)
except russian_quotes.ServerError:
print('Error!')