Skip to main content

build Python 3.8 GPLv3 license PyPI version Downloads CodeQL Quality Gate Status Security Rating

cleverbotfree

Cleverbot.com used to have a free API for their chatbot application. They have
removed their free API in place of a tiered subscription API service.
cleverbotfree is a free alternative to that API that uses a headless Firefox
browser to communicate with their chatbot application. You can use this module
to create applications/bots that send and receive messages to the Cleverbot
chatbot application.

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.

pip install cleverbotfree

Drivers

This library uses the Playwright library to interface the Cleverbot website
with a headless Firefox browser.
To download the Playwright Firefox browser binary simply run this command after
installing cleverbotfree:

playwright install firefox

Usage

Examples

Example of a simple CLI script that creates a persistent chat session until closed.

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.

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:"))

Metadata

Release files for cleverbotfree 2.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cleverbotfree 2.3.6
File Size Uploaded Provenance Actions
cleverbotfree-2.3.6.tar.gz 17.7 kB Without provenance Details for cleverbotfree-2.3.6.tar.gz

Release files / cleverbotfree-2.3.6.tar.gz

Download URL cleverbotfree-2.3.6.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
696ae5a143baa89e1cac6c1f025618e915015c85e9c47e0f20b5d4bf7a58edf2
BLAKE2b-256 checksum
How to use checksums
df7d343653a4e2db785bb489bfce57bbe652be41795686f1fe9c8555a0526641
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for cleverbotfree 2.3.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page