New Fask library to make uploading, storing & streaming files easy!
Hi guys
I have just finished work on a new Flask library to make uploading files and storing them on your server & database as easy as possible... just let Flask-File-Upload handle all the repetitive work!
Works with Flask & Flask-SQLAlchemy
[https://github.com/joegasewicz/Flask-File-Upload](https://github.com/joegasewicz/Flask-File-Upload)
​
I would be very grateful if anyone wishes to try out this library & or give some feed back. And of course contributions are welcome!
Thanks so much
Joe
​
https://preview.redd.it/ppd6fr092g941.jpg?width=2200&format=pjpg&auto=webp&s=9fe80a5d18d313158672805eddb42edbfd1de506
\#python #flask #sqlalchemy
/r/flask
https://redd.it/elk36d
Hi guys
I have just finished work on a new Flask library to make uploading files and storing them on your server & database as easy as possible... just let Flask-File-Upload handle all the repetitive work!
Works with Flask & Flask-SQLAlchemy
[https://github.com/joegasewicz/Flask-File-Upload](https://github.com/joegasewicz/Flask-File-Upload)
​
I would be very grateful if anyone wishes to try out this library & or give some feed back. And of course contributions are welcome!
Thanks so much
Joe
​
https://preview.redd.it/ppd6fr092g941.jpg?width=2200&format=pjpg&auto=webp&s=9fe80a5d18d313158672805eddb42edbfd1de506
\#python #flask #sqlalchemy
/r/flask
https://redd.it/elk36d
GitHub
joegasewicz/flask-file-upload
Easy file uploads for Flask. Contribute to joegasewicz/flask-file-upload development by creating an account on GitHub.
A new Flask library to help make authenticating users super easy! Login users with ease :)
I'm releasing v0.1.0 this weekend of a Flask library that helps to make logging in users super easy!
If you want to develop Flasks app's fast & not spend all your time solving authorisation of all your resources / requests, then maybe this library can be useful for you..
Works out of the box with Flask-SQLAlchemy, so after you set up a user model with Flask-JWT-Router you no longer have to worry about handling any authenticating of that user or authorising routes associated with that users allowed resource access...
[https://github.com/joegasewicz/flask-jwt-router](https://github.com/joegasewicz/flask-jwt-router)
Could be useful for SPA's like AngularJS & ReactJS
Thank you very much for your time,
Joe
https://preview.redd.it/p8mxk63zm7e41.png?width=2506&format=png&auto=webp&s=0e231bc93f36b1f31557ea3e88627e50fe1bdf44
​
\#Python #ReactJS #Flask #SLQAlchemy #JWT
/r/flask
https://redd.it/ewy5sm
I'm releasing v0.1.0 this weekend of a Flask library that helps to make logging in users super easy!
If you want to develop Flasks app's fast & not spend all your time solving authorisation of all your resources / requests, then maybe this library can be useful for you..
Works out of the box with Flask-SQLAlchemy, so after you set up a user model with Flask-JWT-Router you no longer have to worry about handling any authenticating of that user or authorising routes associated with that users allowed resource access...
[https://github.com/joegasewicz/flask-jwt-router](https://github.com/joegasewicz/flask-jwt-router)
Could be useful for SPA's like AngularJS & ReactJS
Thank you very much for your time,
Joe
https://preview.redd.it/p8mxk63zm7e41.png?width=2506&format=png&auto=webp&s=0e231bc93f36b1f31557ea3e88627e50fe1bdf44
​
\#Python #ReactJS #Flask #SLQAlchemy #JWT
/r/flask
https://redd.it/ewy5sm
GitHub
GitHub - joegasewicz/flask-jwt-router: Flask JWT Router is a Python library that adds authorised routes to a Flask app.
Flask JWT Router is a Python library that adds authorised routes to a Flask app. - GitHub - joegasewicz/flask-jwt-router: Flask JWT Router is a Python library that adds authorised routes to a Flask...
Deploying Flask on Google Cloud with IAP | (Identity Aware Proxy) in 5 minutes
https://youtu.be/LKoFKS8Y5v4
/r/flask
https://redd.it/hdbrza
https://youtu.be/LKoFKS8Y5v4
/r/flask
https://redd.it/hdbrza
YouTube
Deploying Flask on Google Cloud with IAP | (Identity Aware Proxy) in 5 minutes
Deploying Flask on Google Cloud with IAP | (Identity Aware Proxy) in 5 minutes
#Flask #Google Cloud
-~-~~-~~~-~~-~-
Please watch: "LRU Cache (With Python Code) "
https://www.youtube.com/watch?v=oXHLu4WCs9I
-~-~~-~~~-~~-~-
#Flask #Google Cloud
-~-~~-~~~-~~-~-
Please watch: "LRU Cache (With Python Code) "
https://www.youtube.com/watch?v=oXHLu4WCs9I
-~-~~-~~~-~~-~-
FlaskEase - Flask extension for creating REST APIs and OpenAPI docs with ease, inspired from FastAPI.
Yet another [\#Flask](https://twitter.com/hashtag/Flask?src=hashtag_click) REST API extension(mine is experimental) -> [https://github.com/zero-shubham/flask-ease](https://github.com/zero-shubham/flask-ease) inspired from [@tiangolo](https://twitter.com/tiangolo)'s [\#Fastapi](https://twitter.com/hashtag/Fastapi?src=hashtag_click)
/r/flask
https://redd.it/hp6rha
Yet another [\#Flask](https://twitter.com/hashtag/Flask?src=hashtag_click) REST API extension(mine is experimental) -> [https://github.com/zero-shubham/flask-ease](https://github.com/zero-shubham/flask-ease) inspired from [@tiangolo](https://twitter.com/tiangolo)'s [\#Fastapi](https://twitter.com/hashtag/Fastapi?src=hashtag_click)
/r/flask
https://redd.it/hp6rha
Twitter
#flask hashtag on Twitter
See Tweets about #flask on Twitter. See what people are saying and join the conversation.
That's it, today I published the last episode for the Flask series, a full-featured web application built with Python including Authentication System. And most important, over 6 hours of deep explanations for you to start developing websites with Python!
https://youtube.com/watch?v=ByNEqsh7I4Q&feature=share
/r/flask
https://redd.it/l3zoc3
https://youtube.com/watch?v=ByNEqsh7I4Q&feature=share
/r/flask
https://redd.it/l3zoc3
YouTube
Flask Full Series - Web Application Development with Python - Item Selling - Episode 16 | FINAL EP.
Flask Python
#Flask #Python #FlaskTutorial
👍Welcome to my Python Flask tutorial
In this episode, we will complete the algorithm for item selling, it is going to be quite similar to what we have configured for item purchasing, so I cover this topic a little…
#Flask #Python #FlaskTutorial
👍Welcome to my Python Flask tutorial
In this episode, we will complete the algorithm for item selling, it is going to be quite similar to what we have configured for item purchasing, so I cover this topic a little…
I created a tutorial on how to deploy a Flask application with docker-compose to production, it will be a series with three parts, here is the first one where we are getting started :)
https://youtube.com/watch?v=p0HnnJ6CusM&feature=share
/r/flask
https://redd.it/mak2fk
https://youtube.com/watch?v=p0HnnJ6CusM&feature=share
/r/flask
https://redd.it/mak2fk
YouTube
Python Web Application Deployment Tutorial - Using Docker & Docker Compose - Part 1
#Flask #Docker #DockerCompose #PythonWelcome to a new series about Flask and Docker combined! In this video, you will learn the best practices to deploy your...
Session Cookies for protected routes/pages - How secure is it?
Flask has build-in Session handler (https://flask.palletsprojects.com/en/1.1.x/api/#flask.session). I use the Firebase Authentication SDK to login users, set a client session cookie to i.e. session['login'\] = true (and might add an expiration time) and check on each protected page request if get.session('login) == True. The cookie can't be modified, as it's signed on the server.
Why should I use additional frameworks like JWT and submit a Bearer Token with each request? I don't see any security issues with the session cookies I'm already using.
/r/flask
https://redd.it/n89r4m
Flask has build-in Session handler (https://flask.palletsprojects.com/en/1.1.x/api/#flask.session). I use the Firebase Authentication SDK to login users, set a client session cookie to i.e. session['login'\] = true (and might add an expiration time) and check on each protected page request if get.session('login) == True. The cookie can't be modified, as it's signed on the server.
Why should I use additional frameworks like JWT and submit a Bearer Token with each request? I don't see any security issues with the session cookies I'm already using.
/r/flask
https://redd.it/n89r4m
reddit
Session Cookies for protected routes/pages - How secure is it?
Flask has build-in Session handler ...
Keep Python state across Flask requests (stateful API)
I've got a Flask endpoint that calls a Flask (API) endpoint (with AJAX) when the user clicks a button.
The API endpoint gets data from a (Postgres) database.
So, server-side, something like:
But I want the API to be stateful (non-REST), where the state is kept by the server.
The state contains the following:
- A Postgres connection
- A Postgres cursor (containing the results from an expensive query)
- A counter
So I open a Postgres connection and store it in `flask.g`:
And I'm also storing the Postgres the cursor and the counter in
Now, I'm storing the database connection in
/r/flask
https://redd.it/q877nd
I've got a Flask endpoint that calls a Flask (API) endpoint (with AJAX) when the user clicks a button.
The API endpoint gets data from a (Postgres) database.
So, server-side, something like:
import flask
import psycopg2 # postgres wrapper
app = flask.Flask(__name__)
@app.get('/search')
def search():
return flask.render_template('search.html')
@app.get('api')
def api():
db = db_get()
cur = db.cursor()
cur.execute('SELECT * FROM table0 OFFSET 0')
return flask.jsonify(cur.fetchmany(3))
But I want the API to be stateful (non-REST), where the state is kept by the server.
The state contains the following:
- A Postgres connection
- A Postgres cursor (containing the results from an expensive query)
- A counter
So I open a Postgres connection and store it in `flask.g`:
def db_get(): # taken from https://flask.palletsprojects.com/en/2.0.x/tutorial/database/
if 'db' not in flask.g:
flask.g.db = psycopg2.connect(f'host={PSQL_HOST} port={PSQL_PORT} dbname={PSQL_DBNAME} user={PSQL_USER} password={PSQL_PASSWORD} connect_timeout=60')
return flask.g.db
And I'm also storing the Postgres the cursor and the counter in
g:@app.get('api')
def api():
if 'count' not in flask.g: flask.g.count = 0
if 'cur' not in flask.g:
flask.g.cur = db_get().cursor(name='name')
flask.g.cur.execute("SELECT * FROM table0 OFFSET %s LIMIT 1000000", [3*flask.current_app.count])
flask.g.count += 1
return flask.jsonify(flask.g.cur.fetchmany(3))
Now, I'm storing the database connection in
g because/r/flask
https://redd.it/q877nd
Dynamically set variable in route wrapper
I'm using Flask-Limiter and would like to set the cost parameter on a per request basis. I can't figure out a way to get a variable passed to this parameter that would be dependent on the request. If I just pass in current\_user.zipcode\_changes I get an error saying I can't pass None type in.
[https://flask-limiter.readthedocs.io/en/stable/api.html#flask\_limiter.Limiter.limit.params.cost](https://flask-limiter.readthedocs.io/en/stable/api.html#flask_limiter.Limiter.limit.params.cost)
​
My attempt always returns 1.
The gist of my code:
def func_cost():
if current_user:
return current_user.zipcode_changes
else:
return 1
@bp.route('/zipocdes', methods=['GET','POST']
@limiter.limit("10 per day", key_func=lambda: current_user.id, methods=["POST"],\
deduct_when=func_deduct, cost=func_cost)
@login_required
def zipcodes():
form = ZipcodeForm()
if form.validate_on_submit():
current_user.zipcode_changes = len(added_zips)
/r/flask
https://redd.it/szlzi7
I'm using Flask-Limiter and would like to set the cost parameter on a per request basis. I can't figure out a way to get a variable passed to this parameter that would be dependent on the request. If I just pass in current\_user.zipcode\_changes I get an error saying I can't pass None type in.
[https://flask-limiter.readthedocs.io/en/stable/api.html#flask\_limiter.Limiter.limit.params.cost](https://flask-limiter.readthedocs.io/en/stable/api.html#flask_limiter.Limiter.limit.params.cost)
​
My attempt always returns 1.
The gist of my code:
def func_cost():
if current_user:
return current_user.zipcode_changes
else:
return 1
@bp.route('/zipocdes', methods=['GET','POST']
@limiter.limit("10 per day", key_func=lambda: current_user.id, methods=["POST"],\
deduct_when=func_deduct, cost=func_cost)
@login_required
def zipcodes():
form = ZipcodeForm()
if form.validate_on_submit():
current_user.zipcode_changes = len(added_zips)
/r/flask
https://redd.it/szlzi7
Flask-Limiter
API
Extension: Limit objects: The following dataclasses can be used to define rate limits with more granularity than what is available through the Limiter constructor if needed (especially for default,...
What is the point of request.content_md5 / Content-MD5 Header?
Flask has a `request.content_md5` which corresponds to the `Content-MD5` header. The [docs](https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.content_md5) say:
> The Content-MD5 entity-header field, as defined in RFC 1864, is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)
What is the point of this?
I tried sending a request with a bogus value in the Content-MD5 header, and flask did not automatically fail the request.
Am I supposed to write some code that computes the hash of the request body and compare it against Content-MD5, if this is present, and then ask my clients to compute the MD5 and put it in the Content-MD5 header?
I would have assumed that clients would automatically do this as part of the client library, and the flask would automatically compare the md5 and fail with an error. It seems like this does not happen.
/r/flask
https://redd.it/xatptz
Flask has a `request.content_md5` which corresponds to the `Content-MD5` header. The [docs](https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.content_md5) say:
> The Content-MD5 entity-header field, as defined in RFC 1864, is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)
What is the point of this?
I tried sending a request with a bogus value in the Content-MD5 header, and flask did not automatically fail the request.
Am I supposed to write some code that computes the hash of the request body and compare it against Content-MD5, if this is present, and then ask my clients to compute the MD5 and put it in the Content-MD5 header?
I would have assumed that clients would automatically do this as part of the client library, and the flask would automatically compare the md5 and fail with an error. It seems like this does not happen.
/r/flask
https://redd.it/xatptz
Nesting Blueprints with Blueprint.registerblueprint() fails
Even though the [Flask Docs](https://flask.palletsprojects.com/en/2.2.x/api/#flask.Blueprint.registerblueprint) state that a Blueprint can register further blueprints, I get the following error:
>AttributeError: 'Blueprint' object has no attribute 'register_blueprint'
Does someone know how I can achieve nesting blueprints?
Code
/r/flask
https://redd.it/100qn8a
Even though the [Flask Docs](https://flask.palletsprojects.com/en/2.2.x/api/#flask.Blueprint.registerblueprint) state that a Blueprint can register further blueprints, I get the following error:
>AttributeError: 'Blueprint' object has no attribute 'register_blueprint'
Does someone know how I can achieve nesting blueprints?
Code
/r/flask
https://redd.it/100qn8a
Learn Restful API with Flask
🚀 Mastering RESTful APIs with Python and Flask 🚀
Are you ready to take your skills to the next level? I'm excited to announce the launch of my new Udemy course, designed to help you achieve your goals and excel in your field!🎓 Course Highlights:
* Comprehensive, easy-to-follow lessons
* Practical exercises and real-world examples
* Learn at your own pace, from anywhere
💡 Why Enroll?Whether you're a beginner looking to get started or a seasoned professional seeking to refine your skills, this course has something for everyone. Gain in-depth knowledge, practical skills, and the confidence to succeed.
🔗 Enroll Now: [https://www.udemy.com/course/mastering-restful-apis-a-comprehensive-guide/?referralCode=727DF5F0596A9494D3B5](https://www.udemy.com/course/mastering-restful-apis-a-comprehensive-guide/?referralCode=727DF5F0596A9494D3B5)
Join me on this exciting learning journey and unlock your full potential. See you in the course!
#Udemy #Python #flask #OnlineLearning #SkillDevelopment #Education #CourseLaunch #LearnFromHome
/r/flask
https://redd.it/1dnamd8
🚀 Mastering RESTful APIs with Python and Flask 🚀
Are you ready to take your skills to the next level? I'm excited to announce the launch of my new Udemy course, designed to help you achieve your goals and excel in your field!🎓 Course Highlights:
* Comprehensive, easy-to-follow lessons
* Practical exercises and real-world examples
* Learn at your own pace, from anywhere
💡 Why Enroll?Whether you're a beginner looking to get started or a seasoned professional seeking to refine your skills, this course has something for everyone. Gain in-depth knowledge, practical skills, and the confidence to succeed.
🔗 Enroll Now: [https://www.udemy.com/course/mastering-restful-apis-a-comprehensive-guide/?referralCode=727DF5F0596A9494D3B5](https://www.udemy.com/course/mastering-restful-apis-a-comprehensive-guide/?referralCode=727DF5F0596A9494D3B5)
Join me on this exciting learning journey and unlock your full potential. See you in the course!
#Udemy #Python #flask #OnlineLearning #SkillDevelopment #Education #CourseLaunch #LearnFromHome
/r/flask
https://redd.it/1dnamd8
Udemy
Mastering RESTful APIs with Python and Flask
From Design to Deployment: Unlock the Power of RESTful APIs for Seamless Web Integration
How to setup a permanent session in default Flask?
If I use Flask-Session to store session data server-side, it is as easy as passing
If I use default Flask to store session data client-side, I need to set
What I don't understand is how to setup the default Flask one. I tried to google, and found this in Stack Overflow. The accepted answer suggests setting it with before\_request, but I think why every request, we need to set
1. How to set permanent sessions in default flask properly? Where to set it?
2. Can you toggle permanent and non permanent session?
3. What should we do after session is expired? What about the session data?
/r/flask
https://redd.it/1gdur94
If I use Flask-Session to store session data server-side, it is as easy as passing
SESSION_PERMANENT = False (not default Flask, unique to Flask-Session) to the app.config, then set the desired expiration time with , PERMANENT_SESSION_LIFETIME = desired_exp_time which is default Flask config. If I use default Flask to store session data client-side, I need to set
PERMANENT_SESSION_LIFETIME = desired_exp_time first, then state session.permanent = True in the request (ex. u/app.route), else I get this error: RuntimeError: Working outside of request context. The docs is somewhat unclear about how to implement, see here.What I don't understand is how to setup the default Flask one. I tried to google, and found this in Stack Overflow. The accepted answer suggests setting it with before\_request, but I think why every request, we need to set
session.permanent = True?1. How to set permanent sessions in default flask properly? Where to set it?
2. Can you toggle permanent and non permanent session?
3. What should we do after session is expired? What about the session data?
/r/flask
https://redd.it/1gdur94
Stack Overflow
Flask permanent session: where to define them?
By default, Flask uses volatile sessions, which means the session cookie is set to expire when browser closes. In order to use permanent sessions, which will use a cookie with a defined expiratio...
Flask Async Mail
🚀 Introducing Flask-Async-Mail! 📧
Hey everyone! I just released Flask-Async-Mail, a lightweight and flexible asynchronous email-sending library for Flask apps using Celery. 🎉
🔹 Features:
✅ Supports both synchronous & asynchronous email sending
✅ Works with Celery & Redis
✅ Supports plaintext & HTML emails
✅ Simple setup & easy integration with Flask
👉 Try it out & contribute!
📦 PyPI: https://pypi.org/project/flask-async-mail/
💻 GitHub: https://github.com/manitreasure1/flas-async-mail.git
I’d love your feedback, contributions, and ⭐ stars on GitHub! Let’s build something awesome together. 🚀🔥
\#Flask #Python #Async #Email #OpenSource
/r/flask
https://redd.it/1j10wib
🚀 Introducing Flask-Async-Mail! 📧
Hey everyone! I just released Flask-Async-Mail, a lightweight and flexible asynchronous email-sending library for Flask apps using Celery. 🎉
🔹 Features:
✅ Supports both synchronous & asynchronous email sending
✅ Works with Celery & Redis
✅ Supports plaintext & HTML emails
✅ Simple setup & easy integration with Flask
👉 Try it out & contribute!
📦 PyPI: https://pypi.org/project/flask-async-mail/
💻 GitHub: https://github.com/manitreasure1/flas-async-mail.git
I’d love your feedback, contributions, and ⭐ stars on GitHub! Let’s build something awesome together. 🚀🔥
\#Flask #Python #Async #Email #OpenSource
/r/flask
https://redd.it/1j10wib
Need Career Advice: Stuck in .NET Web Forms, Should I Switch to Python Flask?
Hi everyone,
I’ve been working at a company for the past 4 months. I was hired to work on a .NET Web Forms project, but the pace of work is extremely slow. For the last 3 months, I haven’t written any real code — I’ve just been learning about Web Forms.
The company is saying they’ll give me actual work on an ERP project starting next week, but honestly, I’m not feeling confident. I’ve been told there will be no proper mentorship or guidance, and I find ERP systems really hard to grasp.
On the other hand, I’m passionate about innovation and working with new technologies. I really enjoy Python and I’ve been considering switching over to Flask development instead, since it aligns more with what I want to do in the future.
I’m feeling a lot of stress and confusion right now. Should I stick it out with this company and the ERP/.NET stuff, or should I start focusing on Python Flask and make a shift in that direction?
Any advice from experienced developers would be really appreciated. Thanks!
\#CareerAdvice #DotNet #Python #Flask #ERP #WebForms #JuniorDeveloper #ProgrammingHelp
/r/flask
https://redd.it/1mbebbe
Hi everyone,
I’ve been working at a company for the past 4 months. I was hired to work on a .NET Web Forms project, but the pace of work is extremely slow. For the last 3 months, I haven’t written any real code — I’ve just been learning about Web Forms.
The company is saying they’ll give me actual work on an ERP project starting next week, but honestly, I’m not feeling confident. I’ve been told there will be no proper mentorship or guidance, and I find ERP systems really hard to grasp.
On the other hand, I’m passionate about innovation and working with new technologies. I really enjoy Python and I’ve been considering switching over to Flask development instead, since it aligns more with what I want to do in the future.
I’m feeling a lot of stress and confusion right now. Should I stick it out with this company and the ERP/.NET stuff, or should I start focusing on Python Flask and make a shift in that direction?
Any advice from experienced developers would be really appreciated. Thanks!
\#CareerAdvice #DotNet #Python #Flask #ERP #WebForms #JuniorDeveloper #ProgrammingHelp
/r/flask
https://redd.it/1mbebbe
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
app.run() not recommended for development server?
For me it would be convenient to run the Flask development server with
> It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support.
Documentation link: https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run
Instead they suggest to use the command line
But I wonder how its different. Why is Flask.run not recommended?
/r/flask
https://redd.it/1p9t86o
For me it would be convenient to run the Flask development server with
Flask.run() however the documentation says:> It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support.
Documentation link: https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run
Instead they suggest to use the command line
flask run which I currently do.But I wonder how its different. Why is Flask.run not recommended?
/r/flask
https://redd.it/1p9t86o
Reddit
From the flask community on Reddit
Explore this post and more from the flask community