Search code examples
pythonhttp-redirectadminpanel

Redirecting to a website in Python


I'm at Day 1 on Python and I've just made this Admin Login Page script. I would love if it redirects you to a website when you insert the correct username and password. I've already searched on stackoverflow for this but I can't get something "easy". Any suggestions?

print ("Pannello di Log-In in caricamento")
import time
time.sleep (2)
username=raw_input ("USERNAME: ")
if username=="admin":
    time.sleep (1)
    print (" ")
else:
    time.sleep (1)
    print (" ")
password=raw_input ("PASSWORD: ")
if password=="psw":
    time.sleep (1)
    print ("LOGGING-IN")
else:
    time.sleep (1)
    print ("LOGGING-IN")

Solution

  • To open a web page from python:

    import webbrowser
    
    webbrowser.open('http://example.com')  # Go to example.com