diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:27:43 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:27:43 +0000 |
| commit | 4c32fb6428da28a066ba8827903ce002f0829e18 (patch) | |
| tree | 28686d7764c1ff351ab45aed379fe374da15211c | |
| parent | 0954c072d8517ede22ecad4d97feeef38e1a9d0e (diff) | |
automatic import of python-cleverbotfreeopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-cleverbotfree.spec | 393 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 395 insertions, 0 deletions
@@ -0,0 +1 @@ +/cleverbotfree-2.3.5.tar.gz diff --git a/python-cleverbotfree.spec b/python-cleverbotfree.spec new file mode 100644 index 0000000..3ca3b8c --- /dev/null +++ b/python-cleverbotfree.spec @@ -0,0 +1,393 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cleverbotfree +Version: 2.3.5 +Release: 1 +Summary: Free Alternative For The Cleverbot API +License: GPLv3 +URL: https://github.com/plasticuproject/cleverbotfree +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d8/86/b3bf4e2d2493083eef44a7a4ee163bdc4834466d9c24b4b6bf31b16cc77e/cleverbotfree-2.3.5.tar.gz +BuildArch: noarch + + +%description +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml) +[](https://www.python.org/downloads/release/python-380/) +[](http://perso.crans.org/besson/LICENSE.html) +[](https://badge.fury.io/py/cleverbotfree) +[](https://pepy.tech/project/cleverbotfree) +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +# cleverbotfree +Cleverbot.com used to have a free API for their chatbot application. They have <br /> +removed their free API in place of a tiered subscription API service. <br /> +cleverbotfree is a free alternative to that API that uses a headless Firefox <br /> +browser to communicate with their chatbot application. You can use this module <br /> +to create applications/bots that send and receive messages to the Cleverbot <br /> +chatbot application. <br /> + + +## Installation +### Requirments +- node >= 14.16.1 +- Python >= 3.8.0 +- python3-pip >= 21.1.1 + +Once requirments are met, you can install this library through pip. <br /> +``` +pip install cleverbotfree +``` + +### Drivers +This library uses the Playwright library to interface the Cleverbot website <br /> +with a headless Firefox browser. <br /> +To download the Playwright Firefox browser binary simply run this command after <br /> +installing cleverbotfree: <br /> +``` +playwright install firefox +``` + +## Usage +<b>Examples</b> + +Example of a simple CLI script that creates a persistent chat session until closed. <br /> +```python +import asyncio +import cleverbotfree + +def chat(): + """Example code using cleverbotfree sync api.""" + with cleverbotfree.sync_playwright() as p_w: + c_b = cleverbotfree.Cleverbot(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = c_b.single_exchange(user_input) + print('Cleverbot:', bot) + c_b.close() + +chat() + + +async def async_chat(): + """Example code using cleverbotfree async api.""" + async with cleverbotfree.async_playwright() as p_w: + c_b = await cleverbotfree.CleverbotAsync(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = await c_b.single_exchange(user_input) + print('Cleverbot:', bot) + await c_b.close() + +asyncio.run(async_chat()) +``` + +Example of a simple CLI script using the class decorator. <br /> +```python +import asyncio +from cleverbotfree import CleverbotAsync +from cleverbotfree import Cleverbot + +@Cleverbot.connect +def chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree sync api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = bot.single_exchange(user_input) + print(bot_prompt, reply) + bot.close() + +chat("User: ", "Cleverbot:") + + +@CleverbotAsync.connect +async def async_chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree async api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = await bot.single_exchange(user_input) + print(bot_prompt, reply) + await bot.close() + +asyncio.run(async_chat("User: ", "Cleverbot:")) +``` + +%package -n python3-cleverbotfree +Summary: Free Alternative For The Cleverbot API +Provides: python-cleverbotfree +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cleverbotfree +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml) +[](https://www.python.org/downloads/release/python-380/) +[](http://perso.crans.org/besson/LICENSE.html) +[](https://badge.fury.io/py/cleverbotfree) +[](https://pepy.tech/project/cleverbotfree) +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +# cleverbotfree +Cleverbot.com used to have a free API for their chatbot application. They have <br /> +removed their free API in place of a tiered subscription API service. <br /> +cleverbotfree is a free alternative to that API that uses a headless Firefox <br /> +browser to communicate with their chatbot application. You can use this module <br /> +to create applications/bots that send and receive messages to the Cleverbot <br /> +chatbot application. <br /> + + +## Installation +### Requirments +- node >= 14.16.1 +- Python >= 3.8.0 +- python3-pip >= 21.1.1 + +Once requirments are met, you can install this library through pip. <br /> +``` +pip install cleverbotfree +``` + +### Drivers +This library uses the Playwright library to interface the Cleverbot website <br /> +with a headless Firefox browser. <br /> +To download the Playwright Firefox browser binary simply run this command after <br /> +installing cleverbotfree: <br /> +``` +playwright install firefox +``` + +## Usage +<b>Examples</b> + +Example of a simple CLI script that creates a persistent chat session until closed. <br /> +```python +import asyncio +import cleverbotfree + +def chat(): + """Example code using cleverbotfree sync api.""" + with cleverbotfree.sync_playwright() as p_w: + c_b = cleverbotfree.Cleverbot(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = c_b.single_exchange(user_input) + print('Cleverbot:', bot) + c_b.close() + +chat() + + +async def async_chat(): + """Example code using cleverbotfree async api.""" + async with cleverbotfree.async_playwright() as p_w: + c_b = await cleverbotfree.CleverbotAsync(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = await c_b.single_exchange(user_input) + print('Cleverbot:', bot) + await c_b.close() + +asyncio.run(async_chat()) +``` + +Example of a simple CLI script using the class decorator. <br /> +```python +import asyncio +from cleverbotfree import CleverbotAsync +from cleverbotfree import Cleverbot + +@Cleverbot.connect +def chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree sync api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = bot.single_exchange(user_input) + print(bot_prompt, reply) + bot.close() + +chat("User: ", "Cleverbot:") + + +@CleverbotAsync.connect +async def async_chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree async api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = await bot.single_exchange(user_input) + print(bot_prompt, reply) + await bot.close() + +asyncio.run(async_chat("User: ", "Cleverbot:")) +``` + +%package help +Summary: Development documents and examples for cleverbotfree +Provides: python3-cleverbotfree-doc +%description help +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml) +[](https://www.python.org/downloads/release/python-380/) +[](http://perso.crans.org/besson/LICENSE.html) +[](https://badge.fury.io/py/cleverbotfree) +[](https://pepy.tech/project/cleverbotfree) +[](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +[](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree) +# cleverbotfree +Cleverbot.com used to have a free API for their chatbot application. They have <br /> +removed their free API in place of a tiered subscription API service. <br /> +cleverbotfree is a free alternative to that API that uses a headless Firefox <br /> +browser to communicate with their chatbot application. You can use this module <br /> +to create applications/bots that send and receive messages to the Cleverbot <br /> +chatbot application. <br /> + + +## Installation +### Requirments +- node >= 14.16.1 +- Python >= 3.8.0 +- python3-pip >= 21.1.1 + +Once requirments are met, you can install this library through pip. <br /> +``` +pip install cleverbotfree +``` + +### Drivers +This library uses the Playwright library to interface the Cleverbot website <br /> +with a headless Firefox browser. <br /> +To download the Playwright Firefox browser binary simply run this command after <br /> +installing cleverbotfree: <br /> +``` +playwright install firefox +``` + +## Usage +<b>Examples</b> + +Example of a simple CLI script that creates a persistent chat session until closed. <br /> +```python +import asyncio +import cleverbotfree + +def chat(): + """Example code using cleverbotfree sync api.""" + with cleverbotfree.sync_playwright() as p_w: + c_b = cleverbotfree.Cleverbot(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = c_b.single_exchange(user_input) + print('Cleverbot:', bot) + c_b.close() + +chat() + + +async def async_chat(): + """Example code using cleverbotfree async api.""" + async with cleverbotfree.async_playwright() as p_w: + c_b = await cleverbotfree.CleverbotAsync(p_w) + while True: + user_input = input("User: ") + if user_input == 'quit': + break + bot = await c_b.single_exchange(user_input) + print('Cleverbot:', bot) + await c_b.close() + +asyncio.run(async_chat()) +``` + +Example of a simple CLI script using the class decorator. <br /> +```python +import asyncio +from cleverbotfree import CleverbotAsync +from cleverbotfree import Cleverbot + +@Cleverbot.connect +def chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree sync api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = bot.single_exchange(user_input) + print(bot_prompt, reply) + bot.close() + +chat("User: ", "Cleverbot:") + + +@CleverbotAsync.connect +async def async_chat(bot, user_prompt, bot_prompt): + """Example code using cleverbotfree async api with decorator.""" + while True: + user_input = input(user_prompt) + if user_input == "quit": + break + reply = await bot.single_exchange(user_input) + print(bot_prompt, reply) + await bot.close() + +asyncio.run(async_chat("User: ", "Cleverbot:")) +``` + +%prep +%autosetup -n cleverbotfree-2.3.5 + +%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-cleverbotfree -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2.3.5-1 +- Package Spec generated @@ -0,0 +1 @@ +f6c4a9d5907dfd0404d8730027112fb8 cleverbotfree-2.3.5.tar.gz |
