Skip to content

Instantly share code, notes, and snippets.

@forceedge01
Last active March 12, 2025 12:54
Show Gist options
  • Save forceedge01/c1b5c97f74e554f1bb534e3a98f2883e to your computer and use it in GitHub Desktop.
Save forceedge01/c1b5c97f74e554f1bb534e3a98f2883e to your computer and use it in GitHub Desktop.
# 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)
@forceedge01
Copy link
Author

forceedge01 commented Mar 12, 2025

Guidelines:

  • You have 10 minutes.
  • You can write pseudo code if you will in your favourite text editor of your choice and share your screen after or write comments on the Gist itself.

Lookout for opportunities to improve:

  • Security
  • Performance
  • Quality
  • Clarity
  • Logical issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment