The RAtlas Revolution: Web Links, Baby!
Hey there, Pythonistas! I’m back with another update on my trusty sidekick, RAtlas — the chatbot that’s been helping you navigate the wild world of Python. You might recall my last post about adding password protection, because security is cool and all, but let’s be real, it’s not exactly the most thrilling topic.
Today, I’m stoked to share the exciting news: RAtlas now comes with web links! That’s right, folks. No more frantically Googling “Python list comprehension” only to realize you had a perfectly good chatbot sitting there that could’ve given you the link in the first place.
Using the awesomeness that is Visual Studio Code, I’ve managed to hook up RAtlas with a bunch of relevant web resources. Now, when you’re chatting with RAtlas about Python topics, it’ll shoot you over some handy links to get you up to speed. Think of it like having a Python-savvy friend who’s always got your back (and a bunch of bookmarks).
Let’s take a look at some of the code behind this feature.
Password Hashing
Python
import secrets
import hashlibdef generate_salt():
return secrets.token_bytes(16)def hash_password(password, salt):
return hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), salt, 100000).hex()
These functions generate a random salt and hash a password using PBKDF2 with SHA-256. The salt is used to prevent rainbow table attacks, and the iteration count (100,000) slows down the hashing process to make it more resistant to brute-force attacks.
Chatbot Menu System
Python
def chatbot_menu():
while True:
print("Welcome, I am ramoyed named Ratlas")
print("How can you help me today?")
print("1. Learn about my services")
print("2. Contact my wife Ralfa (support)")
print("3. Exit")
choice = input("Enter 1, 2, or 3: ")
if choice == "1":
# ...This is the main menu loop of the chatbot. It prints out options and waits for user input. Based on the user’s choice, it will execute different blocks of code.
Get williamFairbairn’s stories in your inbox
Join Medium for free to get updates from this writer.
Web Link Functionality
Python
import webbrowserdef learn_more(url):
open_link = input("Would you like to learn more? (yes/no): ")
if open_link.lower() == "yes":
webbrowser.open(url)options = {
"1": {"title": "Basic obedience commands", "url": "https://www.google.com"},
# ...
}def python_training():
python_choice = input("Enter your choice: ")
if python_choice in options:
print(f"{options[python_choice]['title']} it is!")
learn_more(options[python_choice]["url"])
This code defines a function learn_more that asks the user if they want to learn more about a topic. If they respond with "yes", it opens the corresponding URL in the user's default web browser.
Password Authentication
Python
import getpassdef authenticate_password(salt, hashed_password):
entered_password = getpass.getpass("Enter password to access RAtlas chatbot: ")
if hash_password(entered_password, salt) == hashed_password:
print("Access granted. Loading RAtlas chatbot...")
# Load chatbot
else:
print("Access denied. Incorrect password.")This code checks if the user’s entered password matches the stored hashed password. If it does, it grants access to the chatbot. Otherwise, it denies access.
I’m having a blast working on RAtlas, and I’m excited to see how you’ll use it to level up your Python game. If you’ve got any feedback or suggestions, hit me up! I’m all ears (or in this case, all text).





