diff options
Diffstat (limited to 'python-prsaw2.spec')
-rw-r--r-- | python-prsaw2.spec | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/python-prsaw2.spec b/python-prsaw2.spec new file mode 100644 index 0000000..7148c4e --- /dev/null +++ b/python-prsaw2.spec @@ -0,0 +1,288 @@ +%global _empty_manifest_terminate_build 0 +Name: python-prsaw2 +Version: 0.42 +Release: 1 +Summary: Stands for Python random api wrapper version 2. +License: MIT License +URL: https://github.com/FlamptX/prsaw2 +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/94/47/ead42f4df0f2e1403afa89443a162deb619ac5105ebc3403719906ccf907/prsaw2-0.42.tar.gz +BuildArch: noarch + + +%description +# prsaw2 +Simple python API wrapper for the Random Stuff API. + +- Easy to use +- Wraps the entire API +- Supports both async and sync +- Supports v2, v3 and v4 version of API + +- **[PyPi Package](https://pypi.org/project/prsaw2)** +- **[Documentation](https://flampt.gitbook.io/prsaw2)** + +## Installation +Installation can be done easily using the python package manager `pip` +```bash +pip install prsaw2 +``` + +## Quickstart +Firstly make sure to [get the API key from here](https://api.pgamerx.com/register) + +Here are few examples to get you started. + +### Getting AI response +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_ai_response("Hi there") +client.close() # Not necessary +print(response) +``` + +### Getting random joke +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_joke(type="any") +client.close() # Not necessary +print(response.joke) +``` + +### Getting random image +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_image(type="any") +client.close() +print(response) +``` + +## Async Support +The library also supports async usage. +```py +import prsaw2 +import asyncio + +client = prsaw2.AsyncClient(key="api-key-here") + +async def coro(): + response = await client.get_ai_response("Hello world") + await client.close() + print(response) + +loop = asyncio.get_event_loop() +loop.run_until_complete(coro()) +``` + + + +%package -n python3-prsaw2 +Summary: Stands for Python random api wrapper version 2. +Provides: python-prsaw2 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-prsaw2 +# prsaw2 +Simple python API wrapper for the Random Stuff API. + +- Easy to use +- Wraps the entire API +- Supports both async and sync +- Supports v2, v3 and v4 version of API + +- **[PyPi Package](https://pypi.org/project/prsaw2)** +- **[Documentation](https://flampt.gitbook.io/prsaw2)** + +## Installation +Installation can be done easily using the python package manager `pip` +```bash +pip install prsaw2 +``` + +## Quickstart +Firstly make sure to [get the API key from here](https://api.pgamerx.com/register) + +Here are few examples to get you started. + +### Getting AI response +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_ai_response("Hi there") +client.close() # Not necessary +print(response) +``` + +### Getting random joke +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_joke(type="any") +client.close() # Not necessary +print(response.joke) +``` + +### Getting random image +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_image(type="any") +client.close() +print(response) +``` + +## Async Support +The library also supports async usage. +```py +import prsaw2 +import asyncio + +client = prsaw2.AsyncClient(key="api-key-here") + +async def coro(): + response = await client.get_ai_response("Hello world") + await client.close() + print(response) + +loop = asyncio.get_event_loop() +loop.run_until_complete(coro()) +``` + + + +%package help +Summary: Development documents and examples for prsaw2 +Provides: python3-prsaw2-doc +%description help +# prsaw2 +Simple python API wrapper for the Random Stuff API. + +- Easy to use +- Wraps the entire API +- Supports both async and sync +- Supports v2, v3 and v4 version of API + +- **[PyPi Package](https://pypi.org/project/prsaw2)** +- **[Documentation](https://flampt.gitbook.io/prsaw2)** + +## Installation +Installation can be done easily using the python package manager `pip` +```bash +pip install prsaw2 +``` + +## Quickstart +Firstly make sure to [get the API key from here](https://api.pgamerx.com/register) + +Here are few examples to get you started. + +### Getting AI response +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_ai_response("Hi there") +client.close() # Not necessary +print(response) +``` + +### Getting random joke +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_joke(type="any") +client.close() # Not necessary +print(response.joke) +``` + +### Getting random image +```py +import prsaw2 + +client = prsaw2.Client(key='api-key-here') + +response = client.get_image(type="any") +client.close() +print(response) +``` + +## Async Support +The library also supports async usage. +```py +import prsaw2 +import asyncio + +client = prsaw2.AsyncClient(key="api-key-here") + +async def coro(): + response = await client.get_ai_response("Hello world") + await client.close() + print(response) + +loop = asyncio.get_event_loop() +loop.run_until_complete(coro()) +``` + + + +%prep +%autosetup -n prsaw2-0.42 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-prsaw2 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.42-1 +- Package Spec generated |