%global _empty_manifest_terminate_build 0 Name: python-waifuim.py Version: 4.2.3 Release: 1 Summary: A Python wrapper for waifu.im API. License: MIT URL: https://github.com/Waifu-im/waifuim.py Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b6/b3/e0f03ed1f27ccd2cb66ba83fb0214ecbcaa7161da412c246e3bee2d33872/waifuim.py-4.2.3.tar.gz BuildArch: noarch %description # waifuim.py [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![PyPI](https://img.shields.io/pypi/v/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![License](https://img.shields.io/github/license/Waifu-im/waifuim.py?style=flat-square)](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) A Python wrapper for waifu.im API. ## Table of Contents - [Installation](#Installation) - [Usage](#Usage) - [License](#License) ## Installation **Python 3.6 or higher is required.** Install from PyPI ```shell $ pip install waifuim.py ``` Install from source ```shell $ pip install git+https://github.com/Waifu-im/waifuim.py ``` ## Usage For now, you can only use WaifuAioClient which is async. Maybe a sync client will be released in the future. Most of the methods returns an `Image` instance, the attributes are the same from the ones returned by the API. ### Examples with WaifuAioClient ```python import asyncio from waifuim import WaifuAioClient async def main(): wf = WaifuAioClient() # Get a completely random image image = await wf.search() # Get an image by tags image = await wf.search( included_tags=['waifu','maid'], excluded_tags=['ero'], ) image = await wf.search( excluded_tags=['maid'], is_nsfw='null', height="<=252" ) # Get sfw waifu images ordered by FAVORITES images = await wf.search( included_tags=['waifu'], is_nsfw='null', many=True, order_by='FAVORITES', ) # Get a user favorites favorites = await wf.fav( token='if not provided, use the one in the client constructor', ) # Edit your favorites await wf.fav_delete(3133) await wf.fav_insert( 3133, user_id=11243585148445, token='user_id and token are optional', ) fav_state = await wf.fav_toggle(4401) # will be equal to 'INSERTED' or 'DELETED' await wf.close() # You can also use a context manager but for multiple request it is not recommended async with WaifuAioClient() as wf: # Do your stuff asyncio.run(main()) ``` ### The Image and Tag instance In most of the case the methods will return an `Image` instance. The attributes are the same as the json keys that the api returns. ```python image = await wf.search() >>> image.url >>> 'https://cdn.waifu.im/1982.jpg' str(image) >>> 'https://cdn.waifu.im/1982.jpg' image.signature >>> aa48cd9dc6b64367 image.tags[0] >>> image.tags[0].name >>> 'waifu' ``` ### Some useful kwargs in the constructor ```python from waifuim import WaifuAioClient wf = WaifuAioClient( session=an_aiohttpClientSession_created_asynchronously, app_name="TheNameOfYourApplication", token="The default token to use in routes requiring authentication.", ) # ... ``` ## License MIT © [Buco](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) %package -n python3-waifuim.py Summary: A Python wrapper for waifu.im API. Provides: python-waifuim.py BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-waifuim.py # waifuim.py [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![PyPI](https://img.shields.io/pypi/v/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![License](https://img.shields.io/github/license/Waifu-im/waifuim.py?style=flat-square)](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) A Python wrapper for waifu.im API. ## Table of Contents - [Installation](#Installation) - [Usage](#Usage) - [License](#License) ## Installation **Python 3.6 or higher is required.** Install from PyPI ```shell $ pip install waifuim.py ``` Install from source ```shell $ pip install git+https://github.com/Waifu-im/waifuim.py ``` ## Usage For now, you can only use WaifuAioClient which is async. Maybe a sync client will be released in the future. Most of the methods returns an `Image` instance, the attributes are the same from the ones returned by the API. ### Examples with WaifuAioClient ```python import asyncio from waifuim import WaifuAioClient async def main(): wf = WaifuAioClient() # Get a completely random image image = await wf.search() # Get an image by tags image = await wf.search( included_tags=['waifu','maid'], excluded_tags=['ero'], ) image = await wf.search( excluded_tags=['maid'], is_nsfw='null', height="<=252" ) # Get sfw waifu images ordered by FAVORITES images = await wf.search( included_tags=['waifu'], is_nsfw='null', many=True, order_by='FAVORITES', ) # Get a user favorites favorites = await wf.fav( token='if not provided, use the one in the client constructor', ) # Edit your favorites await wf.fav_delete(3133) await wf.fav_insert( 3133, user_id=11243585148445, token='user_id and token are optional', ) fav_state = await wf.fav_toggle(4401) # will be equal to 'INSERTED' or 'DELETED' await wf.close() # You can also use a context manager but for multiple request it is not recommended async with WaifuAioClient() as wf: # Do your stuff asyncio.run(main()) ``` ### The Image and Tag instance In most of the case the methods will return an `Image` instance. The attributes are the same as the json keys that the api returns. ```python image = await wf.search() >>> image.url >>> 'https://cdn.waifu.im/1982.jpg' str(image) >>> 'https://cdn.waifu.im/1982.jpg' image.signature >>> aa48cd9dc6b64367 image.tags[0] >>> image.tags[0].name >>> 'waifu' ``` ### Some useful kwargs in the constructor ```python from waifuim import WaifuAioClient wf = WaifuAioClient( session=an_aiohttpClientSession_created_asynchronously, app_name="TheNameOfYourApplication", token="The default token to use in routes requiring authentication.", ) # ... ``` ## License MIT © [Buco](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) %package help Summary: Development documents and examples for waifuim.py Provides: python3-waifuim.py-doc %description help # waifuim.py [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![PyPI](https://img.shields.io/pypi/v/waifuim.py?style=flat-square)](https://pypi.org/project/waifuim.py/) [![License](https://img.shields.io/github/license/Waifu-im/waifuim.py?style=flat-square)](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) A Python wrapper for waifu.im API. ## Table of Contents - [Installation](#Installation) - [Usage](#Usage) - [License](#License) ## Installation **Python 3.6 or higher is required.** Install from PyPI ```shell $ pip install waifuim.py ``` Install from source ```shell $ pip install git+https://github.com/Waifu-im/waifuim.py ``` ## Usage For now, you can only use WaifuAioClient which is async. Maybe a sync client will be released in the future. Most of the methods returns an `Image` instance, the attributes are the same from the ones returned by the API. ### Examples with WaifuAioClient ```python import asyncio from waifuim import WaifuAioClient async def main(): wf = WaifuAioClient() # Get a completely random image image = await wf.search() # Get an image by tags image = await wf.search( included_tags=['waifu','maid'], excluded_tags=['ero'], ) image = await wf.search( excluded_tags=['maid'], is_nsfw='null', height="<=252" ) # Get sfw waifu images ordered by FAVORITES images = await wf.search( included_tags=['waifu'], is_nsfw='null', many=True, order_by='FAVORITES', ) # Get a user favorites favorites = await wf.fav( token='if not provided, use the one in the client constructor', ) # Edit your favorites await wf.fav_delete(3133) await wf.fav_insert( 3133, user_id=11243585148445, token='user_id and token are optional', ) fav_state = await wf.fav_toggle(4401) # will be equal to 'INSERTED' or 'DELETED' await wf.close() # You can also use a context manager but for multiple request it is not recommended async with WaifuAioClient() as wf: # Do your stuff asyncio.run(main()) ``` ### The Image and Tag instance In most of the case the methods will return an `Image` instance. The attributes are the same as the json keys that the api returns. ```python image = await wf.search() >>> image.url >>> 'https://cdn.waifu.im/1982.jpg' str(image) >>> 'https://cdn.waifu.im/1982.jpg' image.signature >>> aa48cd9dc6b64367 image.tags[0] >>> image.tags[0].name >>> 'waifu' ``` ### Some useful kwargs in the constructor ```python from waifuim import WaifuAioClient wf = WaifuAioClient( session=an_aiohttpClientSession_created_asynchronously, app_name="TheNameOfYourApplication", token="The default token to use in routes requiring authentication.", ) # ... ``` ## License MIT © [Buco](https://github.com/Waifu-im/waifuim.py/blob/main/LICENSE) %prep %autosetup -n waifuim.py-4.2.3 %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-waifuim.py -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Mon May 29 2023 Python_Bot - 4.2.3-1 - Package Spec generated