Last active
March 12, 2025 12:54
-
-
Save forceedge01/c1b5c97f74e554f1bb534e3a98f2883e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# user_updates.py | |
import db | |
import requests | |
def update_user_login(): | |
if requests.method == 'post': | |
c = db.connect('connection string').cursor() | |
c.execute('select * from users where email like "%' + requests.query.get("n") + '%"') # execute sql here. | |
r = c.fetchall() | |
if r: | |
# Update user last login, this will simply execute an sql. | |
c.query('update users set last_login = NOW() where email = "' + requests.query.get("n") + '"') | |
c.close() | |
return '{"status": "ok", "code": 200}' | |
# main.py | |
from user_updates import update_user_login | |
# Some routing logic to match... | |
match('/', METHOD_POST, update_user_login) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guidelines:
Lookout for opportunities to improve: