Skip to main content

Free Alternative For The Cleverbot API

Project description

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 a recieve messages to the Cleverbot
chatbot application

Installation

Requirments

You need to have Python 3.x, pip, and the latest Firefox browser installed.
Once installed, you can install this library through pip.

pip install cleverbotfree

Drivers

Selenium requires a driver to interface with the headless browser. Firefox
requires geckodriver, which needs to be installed before this module can be
used. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.

You can download the geckodriver at https://github.com/mozilla/geckodriver/releases

Failure to observe this step will give you the error
"Message: ‘geckodriver’ executable needs to be in PATH."

Usage

Examples

Example of a simple CLI script that creates a single use, one message chat session.

import cleverbotfree.cbfree
import sys
cb = cleverbotfree.cbfree.Cleverbot()

def chat():
    userInput = input('User: ')
    response = cb.single_exchange(userInput)
    print(response)
    cb.browser.close()
    sys.exit()

chat()

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

import cleverbotfree.cbfree
import sys
cb = cleverbotfree.cbfree.Cleverbot()

def chat():
    try:
        cb.browser.get(cb.url)
    except:
        cb.browser.close()
        sys.exit()
    while True:
        try:
            cb.get_form()
        except:
            sys.exit()
        userInput = input('User: ')
        if userInput == 'quit':
            break
        cb.send_input(userInput)
        bot = cb.get_response()
        print('Cleverbot: ', bot)
    cb.browser.close()

chat()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cleverbotfree-1.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

cleverbotfree-1.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file cleverbotfree-1.2.tar.gz.

File metadata

  • Download URL: cleverbotfree-1.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

File hashes

Hashes for cleverbotfree-1.2.tar.gz
Algorithm Hash digest
SHA256 5f7b0cd10f16bfaa871b9b54621851958ae8573968ce28bfc39edf97026cff4d
MD5 de6856c87ae4d5a4ef86200b7c1312f8
BLAKE2b-256 16d02563172b1b97a0135669d76a26fef7b1990e8cb7d3e8853470c3831db120

See more details on using hashes here.

File details

Details for the file cleverbotfree-1.2-py3-none-any.whl.

File metadata

  • Download URL: cleverbotfree-1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

File hashes

Hashes for cleverbotfree-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5b45a63ba0c18f802745553055ca633ddcd10253843afa9d4022ea2d2a1b161f
MD5 6d6697bdadd8b4017c0020ed455f69a0
BLAKE2b-256 05041cc49edbcb8224d1b8de9a9af780e9bf0368564a4c0be8cce47ed5c8a251

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page