How can I take input from url in flask from the parameter? I need to take the above Id from input and pass it to other function without again needing to write “id” How can I directly use the id from give_id(id) function and feed it into vid_stream.get_hls_url function? Posting complete demo code, In case someone needs to run locally.
Tag: flask
how to iterate over one field in jinja2
I have a database that looks like this: and I want to group the rows on country and display with something like this: The above doesn’t seem to work as the first for loop results in the following error: Is it possible to extract just one column, and use that to group the rows, just by using jinja2 (i.e. no
How to use Flask API to post two variables via Postman and run a function using them in that call?
I have the following function : ` ` Now I want to use a Flask API and call this function to run with two variables that I will provide via Postman, DOCname and TABLEid, but I’m not sure how to run this at the same time I make an API call ? I tried to run the file under a
Python + pdfkit: Generate stream with pdfkit
I’m trying to use pdfkit to turn html pages into PDFs, and then return a stream of that PDF as this code is a Flask API called by a webpage. As far as I can tell, when you use pdfkit.from_file, you have provide both an input and output path: The problem is, I don’t want to write these files to
Atomic Code in gunicorn multiprocessing / only run code in worker 1?
I am new to gunicorn multiprocessing (by calling gunicorn –worker=X). I am using it with Flask to provide the WSGI implementation for our productive frontend. To use multiprocessing, we pass the above mentioned parameter to unicorn. Our Flask application also uses APScheduler (via Flask-APScheduler) to run a cron task every Y hours. This task searches for new database entries to
Creating a zip file in stream without directory structure
I’m working on a Flask app to return a zip file to a user of a directory (a bunch of photos) but I don’t want to include my server directory structure in the returned zip. Currently, I have this : This works great for creating and returning the zip but the file includes the structure of my server i.e. In
Call a function in all API endpoints with decorator?
I was wondering if there was a way to ensure some function was called in all Flask API endpoints without manually calling the function? This is to prevent repetition in making sure the functions get called, and to avoid mistakes of accidentally forgetting to call it. Maybe with a library or decorator? So i want Thanks in advance! Answer You
input not working trying to redirect from “/’ to “deal”
Hello I am building a blackjack game and I am stuck the deal button is not working and I am trying to get that to redirecting to another URL. Also do I need that many variables to update the game as the client is playing ? This is my third day doing flask after and my first web application. Any
How to recalculate data from table in flask/python?
I want to show df in my app, im using flask to do it. But how can i make the table editable and calculated sum value by using button? I couldn’t found good and easy way to edit that html table, and somehow send it to backend to recalculate. Most tips i found abuot editables tables involve data from sql
Logger not creating logs on log file in flask application;
I want to create logs in my log file, logs can be shown on the terminal but not written on the log files. I created a package imp_calc which has templates and other files inside it, accessing it using run.py which accesses the imp_calc package’s modules. My folder structure is as follows: my init.py file My Routes Folder through which