flask

How to integrate P5JS with Flask-SocketIO

Github Repo Main codes Server: from shopyo.api.module import ModuleHelp from flask_socketio import SocketIO, join_room, leave_room, emit from init import socketio mhelp = ModuleHelp(__file__, __name__) globals()[mhelp.blueprint_str] = mhelp.blueprint module_blueprint = globals()[mhelp.blueprint_str] @module_blueprint.route(“/”) def index(): return mhelp.render(‘index.html’) @socketio.on(‘mouse’)# , namespace=’/chat’) def mouse(data, methods=[‘GET’, ‘POST’]): # print(data) emit(‘mouse’, data, broadcast=True) Client <!DOCTYPE html> <html> <head> <meta charset=”UTF-8″ /> …

How to integrate P5JS with Flask-SocketIO Read More »

How to Integrate Tinymce 5 with Flask (with csrf)

This article shows how to integrate Tinymce 5 with Flask even including csrf protection! Text area <textarea id=”content”></textarea> Tinymce <script type=”text/javascript” src=”https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.10.2/tinymce.min.js”></script> <script type=”text/javascript”> tinymce.init({ selector: ‘#content’, plugins: [ ‘advlist autolink link image imagetools lists charmap print preview hr anchor pagebreak spellchecker’, ‘searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking’, ‘save table contextmenu directionality …

How to Integrate Tinymce 5 with Flask (with csrf) Read More »

Learning Flask To Help With Dog Care: Interview With Chris Hopkinson

Chris has been learning Flask to help with Dog Care. He felt Flask would help him in his business activities! Let’s have a chat with him! Welcome Chris Hopkinson, Can you present yourself, your business? While I have a background in computing, programming, and web development, I have been away from the scene for almost …

Learning Flask To Help With Dog Care: Interview With Chris Hopkinson Read More »

How to implement beautiful notifications in Flask

Since you already know how to implement notifications, let’s see how to implement beautiful notifications in Flask. Using boostrap, we can do: # shopyoapi.html def notify(message, alert_type=”primary”): “”” Used with flash flash(notify(‘blabla’)) Parameters ———- message: str message to be displayed alert_type: str bootstrap class Returns ——- None “”” alert = “”” <div class=”shopyo-alert alert alert-{alert_type} …

How to implement beautiful notifications in Flask Read More »

How to prevent the Open Redirect vulnerability with the next parameter in Flask

Let’s say someone codes a url like this: http://domain.com/do/something?next=http://domain.com/homepage Now an attacker can craft the url like that: http://domain.com/do/something?next=http://evildomain.com/homepage If you don’t sanitise the next, your user will be taken to the evil site. This is the Open Redirect vulnerability. That’s why you must make sure urls are safe. You do it like that: from …

How to prevent the Open Redirect vulnerability with the next parameter in Flask Read More »