Skip to main content

Free cleverbot without headless browser

Project description

Cleverbot Scraper

Simple free cleverbot library that doesn't require running a heavy ram wasting headless web browser to actually chat with the bot, only relying on the requests module. The api is wrapped by the Cleverbot class and you can use the send module to receive responses from cleverbot.

Try it

Install and test with:

pip3 install cleverbot-scraper
python3 -m cleverbot

The last command will start a live session with the cleverbot.

You can also make cleverbot chat with itself with:

python3 -m cleverbot auto

Examples

Chat with the bot

from cleverbot import Cleverbot
bot = Cleverbot()
print("Start the conversation, press Ctrl-c to stop \n")
try:
    while True:
        print(bot.send(input(">> ")))
except KeyboardInterrupt:
    print("Exiting.")

Make the bot chat with itself

from cleverbot import Cleverbot
alice = Cleverbot()
bob = Cleverbot()
message = "Hi there! How are you doing?"
print("Press Ctrl-c to stop \n")
try:
    while True:
        print("Bob: ", message)
        message = alice.send(message)
        print("Alice: ", message)
        message = bob.send(message)
except KeyboardInterrupt:
    print("Exiting.")

Use proxies

If cleverbot.com is returning 403 errors for you you might want to use a proxy:

from cleverbot import Cleverbot
bot = Cleverbot(proxies={'http': 'http://x.x.x.x:yyyy', 'https': 'http://x.x.x.x:yyyy'})
while True: print(bot.send(input(">> ")))

You can also simply pass a list of ip:port:

from cleverbot import Cleverbot
PROXIES = [
    None,
    "x.x.x.x:yyyy",
    "x.x.x.x:yyyy",
    "x.x.x.x:yyyy",
    "x.x.x.x:yyyy",
    "x.x.x.x:yyyy",
]
bot = Cleverbot(proxies=PROXIES)
while True: print(bot.send(input(">> ")))

Use tor as a fallback

Requires torpy with requests extra:

pip3 install torpy[requests]

from cleverbot import Cleverbot
bot = Cleverbot(use_tor_fallback = True)
while True: print(bot.send(input(">> ")))

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

cleverbot-scraper-0.2.7.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

cleverbot_scraper-0.2.7-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file cleverbot-scraper-0.2.7.tar.gz.

File metadata

  • Download URL: cleverbot-scraper-0.2.7.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.4

File hashes

Hashes for cleverbot-scraper-0.2.7.tar.gz
Algorithm Hash digest
SHA256 9f4442261965575270eae37b26978d064f100543795787444bbd534a50104d7c
MD5 b4ec1a468eb1bf825daf570a68a25019
BLAKE2b-256 d9428a165f9e840ce41ee1dcc1021f94735d5b94ea48a1681572260eee63f783

See more details on using hashes here.

File details

Details for the file cleverbot_scraper-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: cleverbot_scraper-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.4

File hashes

Hashes for cleverbot_scraper-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 db847c97282a5f8574b7a3898448e10ea508d6aa555c63aabee632a6dd242581
MD5 a6240336d1b3441f84a929cda874c7e2
BLAKE2b-256 cb74d27f6f05bd39444f7ed88608514db16f65513e691cc1a9c00071008c2d32

See more details on using hashes here.

Supported by

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