Questions tagged [flask]

Flask is a micro-framework for Python based on Werkzeug, Jinja 2 and good intentions.

Filter by
Sorted by
Tagged with
4
votes
1answer
47 views

Account automation through Python (with Flask) and javascript

This is my first time doing a code review so I expect a ton of criticism on this from all you professionals. What am I doing? I'm using python with flask to create a service for my web server. My ...
-1
votes
0answers
8 views

Applying filters in Flaks API with MongoDB

I am trying to filter my data based on nationality field of the data. ...
2
votes
1answer
27 views

REST API stored in a MongoDB Atlas Database

I am building my first REST API using data stored in my MongoDB Atlas Database. I tried to read the REST API conventions with the versioning, using plural nouns for resources and sending the right ...
1
vote
0answers
26 views

Safely log-in and save login info into session [closed]

I would like to ask if this code is safe for user to log-in (save ID to session) and check if user is log-in when visiting site (Dashboard). ...
5
votes
1answer
266 views

Authenticating an internal API with Flask

I'm developing an internal API using Flask, although due to limitations with our platform the endpoints will be accessible over the public internet. It will only have a very small number of users and ...
2
votes
0answers
96 views

Generate dynamic surveys using Python Flask

I'm building a web app using Flask to offer surveys to users. The number of questions on the survey and the type of questions isn't known until runtime. I finally have the code working properly, and ...
0
votes
0answers
35 views

Dynamically configurable ZMQ filter with Flask API

I have a stream of ZMQ messages, I need to filter the right ones and save them in MongoDB. The trick is to have an option to set the filter conditions dynamically. I have come up with this solution ...
0
votes
0answers
33 views

Flask database design for a social media site like Twitter

This is a mysql database that is created through sqlalchemy. I really don't want to rewrite all of it in sql code, but the code should be understandable if you know a tiny bit of MySQL. I am ...
0
votes
2answers
501 views

Simple web based file browser with Flask

I made a simple web-based file browser with Flask. It also shows some metadata of a file. I have a few questions regarding security though. Is it possible for an attacker to escape out of the preset ...
1
vote
0answers
308 views

Flask app for control TCP server

This snippet allows to up and down TCP server via Flask endpoints. I'm seriously concerned about global variables here. And asking for review this code. The main idea is to be able to up/down TCP ...
2
votes
0answers
60 views

Flask app to administrate network interfaces

I made a Flask app that consists of 3 pages. Index: Indexes to the 2 pages SubnetOverview: SSH's into the server and executes ifconfig, then returns the output to ...
3
votes
1answer
75 views

Python Flask website

I'm new to programming and in back-end. Right now I'm trying to learn flask, so I wrote a very simple website that currently encrypts and decrypts the message using RSA and DES. I feel like my app....
1
vote
1answer
106 views

Expiring JWT tokens in Flask

I've been using flask-jwt-extended for my application and one of the problems I had was logging a session out and making sure the token is not usable anymore. I've ...
1
vote
0answers
20 views

Deletion button on a website that enforces database integrity

I am designing a website on which users can configure (CRUD) various objects which are mutually dependent upon other types. I am preventing a cascade delete, so let's say a ...
2
votes
0answers
444 views

Flask-PyMongo best practices to manage a mongodb database using python

The functions below are from a class of slave function which interact with my mongo database. The purpose is to serve a Flask based API by responding with the appropriate data required along with the ...
2
votes
0answers
161 views

Wrapping a web scraper in a RESTful API

The problem I am looking to solve is wrapping a web scraper in a RESTful API such that it can be called programmatically from another application, frontend or microservice. The overall goal is that ...
0
votes
0answers
57 views

Flask models for scores and statistics

I'm not sure whether I need to group a bunch of related methods in a single class or put them in a separate module. Which way would be preferable in Python? Here is what I've got so far but not sure ...
3
votes
0answers
987 views

REST API with flask structure and implementation approach

I recently started writing REST API, I wanted to have a proper structure of project and an approach which is more readable and make more sense interms of organising in a logical order. I took ...
11
votes
2answers
1k views

A website status monitor in Python/Flask

I've written a basic website status checker in Python/Flask which reads a list of URLs from a json file and cycles through them every x seconds to check they're online. It displays the results as a ...
6
votes
2answers
578 views

A simple library using Flask and SQLAlchemy

This is the main.py script that does most of the work of Adding movies (Movie objects) as well as modifying and removing: ...
3
votes
1answer
890 views

Slow Flask-SQLAlchemy query using association tables

I have two models in Flask-SQLAlchemy (Post and Comment) that have many-to-many relationship that is manifested in the third model (post_mentions): ...
8
votes
1answer
237 views

Python function to implement an image-processing pipeline

I have written the following function to process images. Now I am not sure if it's pythonic or considered as spaghetti code. I know being flat is better than nested, but I don't see a way around it. ...
3
votes
0answers
224 views

Flask-SQLAlchemy model structure

I'm seeking a review of my Flask-SQLAlchemy model structure, particularly adherence to DB best practices, such as avoiding duplication, etc. The models represent the relations between Departments, ...
5
votes
1answer
293 views

Flask Framework - user sign in

These functions are more or less the same. They are doing the sign in process for a flask application. A user is retrieved from a database (identified through email address) and the password is ...
6
votes
1answer
237 views

PyFladesk Migration

I wanted to contribute to the PyFladesk project. The objective is to have a function that receives a Flask's app and embeds it in a Qt desktop app. I've already create a Pull Request on the main ...
4
votes
1answer
387 views

Flask web application, with handling for user login status

I am trying to change some variable in base html-template which other html pages inherite from after entering user in personal account. The idea is as follows: there is base html template and there ...
3
votes
2answers
658 views

Conditionally inserting MySQL entries in a Flask app

I am a newbie in back-end developing. I know that the biggest part of back-end development is interaction with database. I established a connection and the code is 100% working, but I am wondering if ...
19
votes
1answer
284 views

Raspberry PI controllable Christmas Tree

After having the scales, thermometer and a coffeemaker connected to the internet, it is finally time for Christmas Tree to become smarter. Hardware 6ft Christmas Tree An addressable WS2811 LED strip ...
3
votes
1answer
50 views

Handling Many Unexpected States with except

I am creating a server with Flask and it has quite a few routes. Most routes require a specific state, such as "logged in" or "process started". All of my functions and methods in packages will throw ...
2
votes
0answers
119 views

Flask WebServer To Test Login

I wrote a small webserver using flask and python to test the response of a program. When the user try to login the program sends to the server a xml file with the data and if everything works, returns ...
4
votes
2answers
214 views

Kik bot made using Flask

I created a Kik messenger bot using Flask microframework and python that accepts POST requests on the provided webhook and then responds appropriately. I have excluded custom module imports because ...
0
votes
1answer
132 views

Creating a proper workflow through version control and a Makefile

disclaimer: I've posted this around but the question keeps being put on hold for being inherently opinionated which I understand, just looking for some vague direction as to how a more experienced ...
1
vote
0answers
313 views

Log visitor info like latitude, longitude to a database

I am collecting each visitor information like ip, lat, longitude, referrer and language and save it into db, then in db I have column in table with counter that increment if user revisits the web site ...
6
votes
1answer
328 views

Getting prices of crypto coins

I have been working on this Raspberry Pi project for a while. It uses the Poloniex API to get prices of crypto coins and it shows the prices on multiple OLED displays. The displays use different i2c ...
4
votes
1answer
306 views

Fetching Python news headlines for Alexa

I've recently added a custom Alexa Flask Briefing skill that calls an API endpoint which scrapes top news headlines from the Planet Python RSS feed. It works - whenever you ask Alexa about the news, ...
1
vote
1answer
116 views

Refresh webpage on change in folder

I want to refresh my web page every time a file is uploaded to the folder. I have a web service written in flask having the following handler ...
5
votes
0answers
56 views

Building a form for rebooting many network devices

I have several IP based devices that, due to building maintenance, occasionally lose their communication with the other devices. Normally you'd have to find the device IP, go to its control page and ...
1
vote
0answers
37 views

API separate request vs logic

Is it a good practice to separate Logic from Request controller in an Api ? Without separation: ...
7
votes
0answers
1k views

Flask view dependency injection

so, first of all, I've been into trying to have a simple dependency container as possible in python and with your help managed to get conceive https://github.com/dareenzo/tinydic, many thanks. Now, I ...
8
votes
2answers
244 views

Trending Machine Learning topics for Alexa

I've created a small Flash Briefing Alexa skill that reports the top 5 trending topics in Machine Learning from the My Bridge service. The feed for the Flash Briefing skill can be pointed to an ...
2
votes
0answers
110 views

REST backend app script for doing CRUD transactions

As a side project, I am working on Tiddly which is a simple Python(Flask) based app for a generic REST backend that could be used for CRUD transactions on any kind of database (using ...
3
votes
0answers
231 views

My live monitoring web app (Flask, guicorne, heroku, and redis) is spamming the source website

As a student, I am working on a project where I need to forward data from an already existing website to a new one, with the data presented in a different manner. In order to do so with my mediocre ...
3
votes
0answers
645 views

Compressed static file serving in flask

Flask comes with built-in static file serving, but compression support is completely missing. I think the way whitenoise implements it and compress files during builds. The following should serve the ...
1
vote
1answer
569 views

GET and POST with Flask - optimum performance

I have this code to POST and save a digest to redis, and retrieve it from redis on a GET. This uses Python and Flask, of course. ...
7
votes
1answer
183 views

Python Flask webserver with small features

With the latest of my projects, I started using Visual Studio Code, which allows for Python linting and also checking for poor practices, such as using over 100 characters in a single line. As you ...
7
votes
1answer
808 views

Saving temporary file for plotting audio waveform

I am developing a web application in Flask - Python. My goal is to let the user upload an mp3/wav file. This file will (for the scope of this question) get processed by the server and a picture ...
1
vote
1answer
169 views

Models in a Simple PyMongo-based Blogging Web App without ORM/ODM

I am currently using PyMongo + Flask for building a simple blogging application. I am not using any kind of ODM, instead I decided to use PyMongo directly. I need to know how to improve my code since ...
1
vote
0answers
627 views

Python - Flask Middleware - Request Session Management Strategy

I am trying to determine what the most appropriate strategy for session management and authentication is for a middleware application which acts to receive a request, send it over to a database, and ...
4
votes
1answer
129 views

Flask Database Model Design

I am developing my first website in Flask using PostgreSQL and I want my database to have professors from all universities and courses in the USA. As I am not very familiar with databases I have ...
0
votes
1answer
548 views

How to optimize the Flask RestFul api

The tutorial is here I want to build a RestFul API with Flask to query User Agent data. Curl script shows below. The api should work with three or two or one or even zero argument. So how to change ...