pythonwebipstreamlitmultiple-users

i want each email to log in with one device


i am currently working on a streamlit (python API) site that displays my courses videos i want only users that paid for the courses watch them but the users log in using their emails so they might share their emails with their friends how do i prevent that?

i tried getting the ip address using this code but the ip kept changing every 2 days so it is not constant (i dont think it's the real ip address i didnot get mine correctly)

NOTE: streamlit apps are deployed in github then using the streamlit cloud it runs the scripts from github.

WEB = 'https://whatismyip.com/'
def get_client_ip():
    try:
        response = requests.get(WEB)
        if response.status_code == 200:
            # everythin is good
            data = response.json()
            return data.get('ip', 'Unknown')
        else:
            return 'Unknown'
    except requests.exceptions.RequestException:
        return 'Unknown'


Solution

  • There appears to be a similar forum post with a solution to log incoming IP addresses by modifying the _BrowserWebSocketHandler.open() function.

    This is the similar post:

    Hope this helps!