a very simple wrapper around requests/aiohttp for uselessfacts.jsph.pl
Project description
rfacts
a very simple wrapper around requests/aiohttp for uselessfacts.jsph.pl
provides 1 object that implements 2 methods, and 5 attributes.
the fact
classmethods get
and aget
each take one argument, and return a fact
instance:
-
language
- Type[str] - the language for the fact to be fetched, can been
orde
each instance of fact
has the following attributes:
-
id
- Type[str] - the id of the fact -
source
- Type[str] - the source for the fact -
permalink
- Type[str] - the permanent link to this fact -
text
- Type[str] - the text of the fact itself -
language
- Type[str] - the language of the fact -
_raw
- Type[dict] - the raw json returned from the api
examples:
from rfacts import fact
def main() -> None:
x = fact.get()
print(x.text)
if __name__ == "__main__":
main()
from rfacts import fact
import asyncio
async def main() -> None:
x = await fact.aget()
print(x.text)
if __name__ == "__main__":
asyncio.run(main())
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
rfacts-0.1.0.tar.gz
(14.4 kB
view hashes)
Built Distribution
rfacts-0.1.0-py3-none-any.whl
(14.4 kB
view hashes)