Skip to main content

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 be en or de

 

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


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 details)

Uploaded Source

Built Distribution

rfacts-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file rfacts-0.1.0.tar.gz.

File metadata

  • Download URL: rfacts-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.7

File hashes

Hashes for rfacts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de4bfb692d4fd55108442c3a3898258c9b42a7742abc27382680647f8925ab1a
MD5 0264521c4b25e88320dc138477086810
BLAKE2b-256 ede9aa63410a0606038f38c170951e642a6ef8bf588a460eefc8676cb52a5f16

See more details on using hashes here.

File details

Details for the file rfacts-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rfacts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.7

File hashes

Hashes for rfacts-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27877ced1959855d6069b519ad994c3241a96cb5c9c947dbbf03c9dfb8ca5491
MD5 1e028e97f1866dc4492c5c6860819b96
BLAKE2b-256 5bb921a8813b4ebe6e9ca71f6f68b8245da078bb300f88d1374d84339fc0b493

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page