[![build](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml/badge.svg)](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml)
[![Python 3.8](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
[![PyPI version](https://badge.fury.io/py/cleverbotfree.svg)](https://badge.fury.io/py/cleverbotfree)
[![Downloads](https://pepy.tech/badge/cleverbotfree)](https://pepy.tech/project/cleverbotfree)
[![CodeQL](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml/badge.svg)](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=plasticuproject_cleverbotfree&metric=alert_status)](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=plasticuproject_cleverbotfree&metric=security_rating)](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:"))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/plasticuproject/cleverbotfree",
"name": "cleverbotfree",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "cleverbot,bot,api,free",
"author": "plasticuproject",
"author_email": "plasticuproject@pm.me",
"download_url": "https://files.pythonhosted.org/packages/df/7d/343653a4e2db785bb489bfce57bbe652be41795686f1fe9c8555a0526641/cleverbotfree-2.3.6.tar.gz",
"platform": null,
"description": "[![build](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml/badge.svg)](https://github.com/plasticuproject/cleverbotfree/actions/workflows/tests.yml)\n[![Python 3.8](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)\n[![PyPI version](https://badge.fury.io/py/cleverbotfree.svg)](https://badge.fury.io/py/cleverbotfree)\n[![Downloads](https://pepy.tech/badge/cleverbotfree)](https://pepy.tech/project/cleverbotfree)\n[![CodeQL](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml/badge.svg)](https://github.com/plasticuproject/cleverbotfree/actions/workflows/codeql.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=plasticuproject_cleverbotfree&metric=alert_status)](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=plasticuproject_cleverbotfree&metric=security_rating)](https://sonarcloud.io/dashboard?id=plasticuproject_cleverbotfree)\n# cleverbotfree\nCleverbot.com used to have a free API for their chatbot application. They have <br />\nremoved their free API in place of a tiered subscription API service. <br />\ncleverbotfree is a free alternative to that API that uses a headless Firefox <br />\nbrowser to communicate with their chatbot application. You can use this module <br />\nto create applications/bots that send and receive messages to the Cleverbot <br />\nchatbot application. <br />\n\n\n## Installation\n### Requirments\n- node >= 14.16.1\n- Python >= 3.8.0\n- python3-pip >= 21.1.1\n \nOnce requirments are met, you can install this library through pip. <br />\n```\npip install cleverbotfree\n```\n\n### Drivers\nThis library uses the Playwright library to interface the Cleverbot website <br />\nwith a headless Firefox browser. <br />\nTo download the Playwright Firefox browser binary simply run this command after <br />\ninstalling cleverbotfree: <br />\n```\nplaywright install firefox\n```\n\n## Usage\n<b>Examples</b>\n\nExample of a simple CLI script that creates a persistent chat session until closed. <br />\n```python\nimport asyncio\nimport cleverbotfree\n\ndef chat():\n \"\"\"Example code using cleverbotfree sync api.\"\"\"\n with cleverbotfree.sync_playwright() as p_w:\n c_b = cleverbotfree.Cleverbot(p_w)\n while True:\n user_input = input(\"User: \")\n if user_input == 'quit':\n break\n bot = c_b.single_exchange(user_input)\n print('Cleverbot:', bot)\n c_b.close()\n\nchat()\n\n\nasync def async_chat():\n \"\"\"Example code using cleverbotfree async api.\"\"\"\n async with cleverbotfree.async_playwright() as p_w:\n c_b = await cleverbotfree.CleverbotAsync(p_w)\n while True:\n user_input = input(\"User: \")\n if user_input == 'quit':\n break\n bot = await c_b.single_exchange(user_input)\n print('Cleverbot:', bot)\n await c_b.close()\n\nasyncio.run(async_chat())\n```\n\nExample of a simple CLI script using the class decorator. <br />\n```python\nimport asyncio\nfrom cleverbotfree import CleverbotAsync\nfrom cleverbotfree import Cleverbot\n\n@Cleverbot.connect\ndef chat(bot, user_prompt, bot_prompt):\n \"\"\"Example code using cleverbotfree sync api with decorator.\"\"\"\n while True:\n user_input = input(user_prompt)\n if user_input == \"quit\":\n break\n reply = bot.single_exchange(user_input)\n print(bot_prompt, reply)\n bot.close()\n\nchat(\"User: \", \"Cleverbot:\")\n\n\n@CleverbotAsync.connect\nasync def async_chat(bot, user_prompt, bot_prompt):\n \"\"\"Example code using cleverbotfree async api with decorator.\"\"\"\n while True:\n user_input = input(user_prompt)\n if user_input == \"quit\":\n break\n reply = await bot.single_exchange(user_input)\n print(bot_prompt, reply)\n await bot.close()\n\nasyncio.run(async_chat(\"User: \", \"Cleverbot:\"))\n```",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Free Alternative For The Cleverbot API",
"version": "2.3.6",
"project_urls": {
"Download": "https://github.com/plasticuproject/cleverbotfree/archive/v2.3.6.tar.gz",
"Homepage": "https://github.com/plasticuproject/cleverbotfree"
},
"split_keywords": [
"cleverbot",
"bot",
"api",
"free"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df7d343653a4e2db785bb489bfce57bbe652be41795686f1fe9c8555a0526641",
"md5": "b30ab70936095333b39b6c2429391d83",
"sha256": "696ae5a143baa89e1cac6c1f025618e915015c85e9c47e0f20b5d4bf7a58edf2"
},
"downloads": -1,
"filename": "cleverbotfree-2.3.6.tar.gz",
"has_sig": false,
"md5_digest": "b30ab70936095333b39b6c2429391d83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17701,
"upload_time": "2024-01-21T19:45:54",
"upload_time_iso_8601": "2024-01-21T19:45:54.951227Z",
"url": "https://files.pythonhosted.org/packages/df/7d/343653a4e2db785bb489bfce57bbe652be41795686f1fe9c8555a0526641/cleverbotfree-2.3.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-21 19:45:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "plasticuproject",
"github_project": "cleverbotfree",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "cleverbotfree"
}