Who does not know the situation when you want to name a new guest, but you are not sure if the name is already taken?
Now I have a solution. It is very simple and tells you immediately if the name is taken or not.
I can give you the script as Python when you want? You need to have Python installed to use it of course… Do everything like above. Just save it as CheckNames.py
while True:
name = input("Enter a name to check:")
try:
import urllib.request
with urllib.request.urlopen("https://voyeur-house.tv/moments") as response:
html = response.read().decode('utf-8')
if name in html:
print("Name taken")
else:
print("Name available")
except Exception as e:
print("An error occurred:", str(e))
choice = input("Do you want to search for another name? (y/n)")
if choice.lower() != 'y':
break
I noticed you used the cmd shell to try and run it. Please try to open Powershell as Admin and navigate where you have the script and then try to open it. You should at least get an error
So, I just highlighted everything from while true down to break and copied and pasted it into a file called namecheck.py. This is how it looks in the file.
while True:
name = input(“Enter a name to check:”)
try:
import urllib.request
with urllib.request.urlopen("https://voyeur-house.tv/moments") as response:
html = response.read().decode('utf-8')
if name in html:
print("Name taken")
else:
print("Name available")
except Exception as e:
print("An error occurred:", str(e))
choice = input("Do you want to search for another name? (y/n)")
if choice.lower() != 'y':
break
Did I get everything, is it formatted correctly? There are no colors. Does that make a difference?
I installed QPython3. Do I open that and run the script within that environment, or is there something else I need to do? When I run it can I enter the name after the file name, or do I have to wait for it to ask me for a name? Thanks for your help.