Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reconnecting within script 403 Client Error: Forbidden for url: http://xxx.xxx.x.xx/app/request?seq=1161143374 #137

Open
bunbunet opened this issue Jan 19, 2024 · 0 comments

Comments

@bunbunet
Copy link

bunbunet commented Jan 19, 2024

Hello, I wrote a script that control a lamp color based on the decibel levels measured by a microphone. I'm using it to help customers of a winery out of my windows to control the loudness of their voices. The script runs automatically every night in a raspberry pi. To deal disconnections and reconnections I added to the script a function that goes like this

connection=False
def connect_lamp():
    try:
        global l530sec
        l530sec = PyL530.L530("xxx.xxx.xxx", "me@mymail", "mypassowrd")

        l530sec.handshake() #Creates the cookies required for further methods
        l530sec.login() #Sends credentials to the plug and creates AES Key and IV for further methods
        global connection
        connection=True
    
    except Exception as e:
        #print(e)
        connection=False
        return
    
while connection==False:
    connect_lamp()

This function work perfectly if the lamp is offline when the script is started, but if the connection is lost afterwards it give the 403 Client Error: Forbidden for etc..
I can share the entire script here or on my github, any suggestion will be greatly appreciated, having this script running properly is of vital importance!!

Thank you very much

Federico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant